2017 © Pedro Peláez
 

library dtms

Classes for manipulate dates and intervals with microseconds precision

image

alroniks/dtms

Classes for manipulate dates and intervals with microseconds precision

  • Wednesday, August 26, 2015
  • by Alroniks
  • Repository
  • 2 Watchers
  • 17 Stars
  • 4,899 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 3 Versions
  • 4 % Grown

The README.md

DateTime with Microseconds

DateTime and DateInterval classes with support of microseconds, (*1)

NOTE! This package not fully tested, so use it with caution.

This small package with two classes just wrapper around built in PHP classes for work with date and time but with support operations with microseconds., (*2)

Installation

Package use PSR-4 standard, so for using this classes just install package using Composer., (*3)

$ composer require alroniks/dtms
{
    "require": {
        "alroniks/dtms": "~0.5"
    }
}
<?php
require 'vendor/autoload.php';

use alroniks\dtms\DateTime;
use alroniks\dtms\DateInterval;

Usage

After installation you can create DateTime instances with microseconds., (*4)

$dt = new DateTime('2015-08-08 10:10:10.123456');
echo $dt->format('Y-m-d H:i:s.u'); // 2015-08-08 10:10:10.123456

Also you can modify DateTime with microseconds. Supported words "microseconds", "microsecond", "micro", "mic"., (*5)

$dt = new DateTime('2015-08-08 10:10:10.123456');
$dt->modify('123456 micro');
echo $dt->format('u'); // 246912

And of course this package allow usage true ISO8601 format for date intervals with microseconds., (*6)

$interval = new DateInterval('PT2.2S');
echo $interval->format('PT%sS'); // PT2.200000S 

Class DateTime support standard methods, such as add, sub, diff, format etc., (*7)

For using native DateTime and DateInteval classes together with package use root namespace for it:, (*8)

$uDateTime = new DateTime(); // DateTime from package
$nativeDateTime = new \DateTime(); // built in DateTime

Note! Current package may work incorrectly with different time zones, so it need extra check and more tests., (*9)

If you found error or weird behavior, send me issue report, please., (*10)

Credits

License

The MIT License (MIT). Please see LICENSE for more information., (*11)

The Versions

26/08 2015

dev-master

9999999-dev http://alroniks.github.io/dtms

Classes for manipulate dates and intervals with microseconds precision

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime interval iso8601 ms microseconds milliseconds fractions

26/08 2015

v0.5.2

0.5.2.0 http://alroniks.github.io/dtms

Classes for manipulate dates and intervals with microseconds precision

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime interval iso8601 ms microseconds milliseconds fractions

26/08 2015

v0.5.1

0.5.1.0 http://alroniks.github.io/dtms

Classes for manipulate dates and intervals with microseconds precision

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime interval iso8601 ms microseconds milliseconds fractions