Skip to content

Thesis Clock

PHP Version RequirementGitHub ReleaseCode CoverageMutation testing badge

Installation

shell
composer require thesis/clock

Usage

WallClock is a basic implementation of the Psr\Clock\ClockInterface that returns the current wall-clock time.

php
use Thesis\Time\WallClock;

$clock = new WallClock();

echo $clock->now()->format('c'); // Outputs current time in ISO 8601 format

Or with a specific timezone:

php
$clock = new WallClock(new DateTimeZone('Europe/Moscow'));

echo $clock->now()->format('c'); // Outputs Moscow time in ISO 8601 format