A library to handle precise timestamps the easy way.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitattributes
.gitignore
.scrutinizer.yml
.travis.yml
LICENSE
README.md
changelog.md
composer.json
phpunit.hhvm.xml
phpunit.php
phpunit.xml

README.md

Jiffy Universal Timestamps

Author Build Status Coverage Status Quality Score Software License Packagist Version Total Downloads

Installation

composer require litipk/php-jiffy

Usage

The PHP Jiffy library provides the UniversalTimestamp class, which allows you to record timestamps with milliseconds and microseconds precision and to convert it to other "timestamp types" whenever you need to do it.

The supported PHP versions are 5.5, 5.6, 7.0 and HHVM.

<?php

use Litipk\Jiffy\UniversalTimestamp;

$now = UniversalTimestamp::now();
$fromDateTime = UniversalTimestamp::fromDateTimeInterface(new \DateTime());
$fromMongoDate = UniversalTimestamp::fromMongoDate(new \MongoDate());

Notice: The MongoDB related methods are only available when the mongo or mongodb extensions are loaded.

Integration with Doctrine

If you want to use Jiffy's UniversalTimesamp objects in your Doctrine models, you can use our adapter layers: