zazalt / chronos
Chronos
dev-master
2017-02-23 14:04 UTC
Requires
- php: >=7.1.0
This package is not auto-updated.
Last update: 2025-01-04 21:37:51 UTC
README
Chronos is a PHP library/package for date and time management.
Requirements
- php >= 7.1.0
Packagist Dependencies
- None
Installation
With composer:
{ "require": { "zazalt/chronos": "dev-master" } }
Usage
$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);