PHP code example of ergebnis / clock
1. Go to this page and download the library: Download ergebnis/clock 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/ */
ergebnis / clock example snippets
declare(strict_types=1);
use Ergebnis\Clock;
$timeZone = new \DateTimeZone('Europe/Berlin');
$clock = new Clock\SystemClock($timeZone);
$now = $clock->now();
declare(strict_types=1);
use Ergebnis\Clock;
$now = new \DateTimeImmutable();
$clock = new Clock\FrozenClock($now);
sleep(5);
$stillNow = $clock->now();
declare(strict_types=1);
use Ergebnis\Clock;
$timeZone = new \DateTimeZone('Europe/Berlin');
$clock = new Clock\SystemClock($timeZone);
$frozenClock = $clock->freeze();
$now = $clock->now();
sleep(5);
$stillNow = $clock->now();