zazalt / chronos
Chronos
dev-master
2017-02-23 14:04 UTC
Requires
- php: >=7.1.0
This package is not auto-updated.
Last update: 2024-09-14 19:47:33 UTC
README
Chronos是一个用于日期和时间管理的PHP库/包。
要求
- php >= 7.1.0
Packagist依赖
- 无
安装
使用composer
{ "require": { "zazalt/chronos": "dev-master" } }
用法
$Chronos = new Zazalt\Chronos\Chronos(); /** * Transform/parse a human date to machine date (Y-m-d) * eg: 28.09.2013 (d.m.Y) => 2013-09-28 * * @return string */ $Chronos->dateToMachineDate($datetime, $humanFormat); /** * Transform/parse a human date to machine date (Y-m-d H:i:s) * eg: 28.09.2013 23:41:12 => 2013-09-28 23:41:12 * * @return string */ $Chronos->dateToMachineDateTime($datetime, $humanFormat); /** * Transform/parse a machine date to human date * eg: 01.09.2013 => 2013-09-01 * */ $Chronos->dateToHuman($datetime, $humanFormat); /** * Return days number between two dates * * @return integer * */ $Chronos->daysBetweenTwoDates($startDate, $endDate); /** * Return months number between two dates * * @return integer */ $Chronos->monthsBetweenTwoDates($startDate, $endDate); /** * Return years number between two dates * * @return integer */ $Chronos->yearsBetweenTwoDates($startDate, $endDate); /** * Not implemented/documented, yet! */ $Chronos->seconds2HMS($secs);