1. Go to this page and download the library: Download palmtree/chrono library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
palmtree / chrono example snippets
use Palmtree\Chrono\Date;
$date = new Date('2019-01-01');
$date->format('d/m/Y');
$anotherDate = new Date('2019-02-01');
$date->isSame($anotherDate, 'year'); // returns true
$date->isSame($anotherDate, 'month'); // returns true
$date->isSame($anotherDate, 'day'); // returns false
$date->isBefore($anotherDate); // returns true
$date->isAfter($anotherDate); // returns false
// returns true if the date object represents the current date
$date->isToday();
use Palmtree\Chrono\Date;
$date = new Date('2019-01-01');
$date->add(10, 'day');
$date->format('Y-m-d'); // returns '2019-01-11'
$date->subtract(1, 'month');
$date->format('Y-m-d'); // returns '2018-12-11'
use Palmtree\Chrono\Time;
$time = new Time('13:00:03');
$time->format('H:i');
$anotherTime = new Time('13:02:01');
$time->isSame($anotherTime, 'hour'); // returns true
$time->isSame($anotherTime, 'minute'); // returns false
$time->isBefore($anotherTime); // returns true
$time->isAfter($anotherTime); // returns false