1. Go to this page and download the library: Download andhikamaheva/date 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/ */
andhikamaheva / date example snippets
'Jenssegers\Date\DateServiceProvider',
'Date' => Jenssegers\Date\Date::class,
use Jenssegers\Date\Date;
Date::setLocale('nl');
echo Date::now()->format('l j F Y H:i:s'); // zondag 28 april 2013 21:58:16
echo Date::parse('-1 day')->diffForHumans(); // 1 dag geleden
$date = Date::createFromFormat('l d F Y', 'zaterdag 21 maart 2015');
$date = new Date();
$date = new Date('2000-01-31');
$date = new Date('2000-01-31 12:00:00');
// With time zone
$date = new Date('2000-01-31', new DateTimeZone('Europe/Brussels'));
$date = new Date('2000-01-31', 'Europe/Brussels');
$date = new Date('now');
$date = new Date('today');
$date = new Date('+1 hour');
$date = new Date('next monday');
$date = new Date('+1000 days');
echo Date::now()->timespan($date);
// 2 years, 8 months, 3 weeks, 5 days
// or even
echo Date::now()->timespan('+1000 days');
$date = new Date('-10 years');
echo $date->age; // 10
$date = new Date('+10 years');
echo $date->age; // -10