1. Go to this page and download the library: Download deoomen/clock-maestro library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
deoomen / clock-maestro example snippets
use ClockMaestro\Clock\FrozenClockMaestro;
// ...
// Use system default timezone
$clock = FrozenClockMaestro::fromSystemTimezone();
$now = $clock->now();
// Use UTC timezone
$clock = FrozenClockMaestro::fromUTC();
$now = $clock->now();
// Use given timezone
$timezone = new DateTimeZone('Mexico/General');
$clock = FrozenClockMaestro::fromTimezone($timezone);
$now = $clock->now();
// Get time as string with default format: `Y-m-d\TH:i:sP` - (ATOM, compatible with ISO-8601 format)
$clock = FrozenClockMaestro::fromUTC();
$nowAsString = $clock->toString(); // ex. 2021-05-13T12:30:00+00:00
// Get time as string with custom foramt
$clock = FrozenClockMaestro::fromUTC();
$nowAsString = $clock->toString('d.m.Y H:i'); // ex. 13.05.2021 12:30
use ClockMaestro\Clock\SystemClockMaestro;
// ...
// Use system default timezone
$clock = SystemClockMaestro::fromSystemTimezone();
$now = $clock->now();
// Use UTC timezone
$clock = SystemClockMaestro::fromUTC();
$now = $clock->now();
// Use given timezone
$timezone = new DateTimeZone('Mexico/General');
$clock = SystemClockMaestro::fromTimezone($timezone);
$now = $clock->now();
// Get time as string with default format: `Y-m-d\TH:i:sP` - (ATOM, compatible with ISO-8601 format)
$clock = SystemClockMaestro::fromUTC();
$nowAsString = $clock->toString(); // ex. 2021-05-13T12:30:00+00:00
// Get time as string with custom foramt
$clock = SystemClockMaestro::fromUTC();
$nowAsString = $clock->toString('d.m.Y H:i'); // ex. 13.05.2021 12:30
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.