wikimedia/timestamp
Creation, parsing, and conversion of timestamps
v2.2.0
2018-09-21 12:02 UTC
Requires
- php: >=5.6.99
Requires (Dev)
- jakub-onderka/php-parallel-lint: 1.0.0
- jakub-onderka/php-console-highlighter: 0.3.2
- mediawiki/mediawiki-codesniffer: 22.0.0
- mediawiki/minus-x: 0.3.1
- ockcyp/covers-validator: 0.5.1 || 0.6.1
- phpunit/phpunit: 4.8.36 || ^6.5
README
Convertible Timestamp for PHP
This library provides a convenient wrapper around DateTime to create, parse, and format timestamps.
Additional documentation about the library can be found on MediaWiki.org.
Usage
$ts = new ConvertibleTimestamp( '2012-07-31T19:01:08Z' );
$formatted = $ts->getTimestamp( TS_UNIX );
// Shorthand
$formatted = ConvertibleTimestamp::convert(
TS_UNIX, '2012-07-31T19:01:08Z'
);
Running tests
composer install --prefer-dist
composer test