bvarent/datetimems
最新稳定版本:v1.1.0
Composer 安装命令:
composer require bvarent/datetimems
包简介
DateTime with microseconds awareness and calculations.
README 文档
README
This small library enables you to make time calculations with microseconds precisions. PHP's built-in DateTime and DateInterval classes will not do that. Except that DateTime does keep microseconds, but will ignore those in its calculations.
Usage
Require this library via composer.
Use in the same way as you would DateTime. The classes extend DateTime, so you can substitute your legacy classes where needed.
Example:
$dtToday = new \DateTimeMS(); $dtTomorrow = clone $dtToday; $dtTomorrow->modify("+1 day -1 microsecond"); $interval = $dtToday->diff($dtTomorrow); print "In between {$dtToday->format('D, H:i:s.u')} and the same second tomorrow are $interval->format('%d days, %h hrs, %i mins, %secs and %u microsecs')."
Warnings
- The comparison operators (< > = etc) do not account for microseconds. (Which is impossible to achieve due to nonexistence of PHP operator overloading.)
- DateTimeMS::modify cannot be used to set microseconds explicitly.
- DateIntervalMS::modify is not implemented.
ToDo
- Improve DateTimeMS::modify
- Implement DateIntervalMS::modify
- Expand the unit tests.
- Test and think about performance.
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2014-11-11