PHP code example of ordinary / datetime
1. Go to this page and download the library: Download ordinary/datetime 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/ */
ordinary / datetime example snippets
$dateTime = new \Ordinary\DateTime\DateTimeImmutable();
var_dump([
'Start of day' => $dateTime->startOfDay()->format('c'),
'End of day' => $dateTime->endOfDay()->format('c'),
'Is leap year' => $dateTime->leapYear(),
'Is same minute' => $dateTime->isSameMinute(new DateTime()),
'Is before' => $dateTime->isBefore(new DateTime()),
'Current hour' => $dateTime->hour(),
'Day of Week' => $dateTime->dayOfWeekEnum(),
]);