amaccis/tai64-datetime

This package is abandoned and no longer maintained. The author suggests using the amaccis/datetai package instead.

A PHP library that extends DateTime class, in order to allow to handle Tai64.

1.0.1 2019-09-30 21:09 UTC

This package is auto-updated.

Last update: 2023-03-19 21:32:16 UTC


README

PHP Version

Build Status Scrutinizer Code Quality

A PHP library that extends DateTime class, in order to allow to handle Tai64.

Installation

Package is available on Packagist, you can install it using Composer.

composer require amaccis/tai64-datetime

Basic usage

If you feel to need a basic knowledge of TAI, TAI64, TAI64N and TAI64NA, read this. Instead, to know more about leap seconds, read this. TAI64N and TAI64NA are not currently managed.

Convert TAI64 into UTC

    use Amaccis/Tai64DateTime/DateTime

    $dateTime = new DateTime("400000002a2b2c2d");
    $utc = $dateTime->format('Y-m-d H:i:s');
    var_dump($utc); // 1992-06-02 08:06:43       

Convert UTC into TAI64

    use Amaccis/Tai64DateTime/DateTime

    $dateTime = new DateTime("1992-06-02 08:06:43");
    $hexString = $dateTime->format("TAI64");
    var_dump($hexString); // 400000002a2b2c2d'