PHP code example of philippwitzmann / date-time-handler
1. Go to this page and download the library: Download philippwitzmann/date-time-handler 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/ */
philippwitzmann / date-time-handler example snippets
$dateTimeHandler = new DateTimeHandler(
$year, $month, $day, $hours, $minutes, $seconds, $timeZone
);
$date = new Date($year + 1, $month, $day);
$time = new Time($hours, $minutes, $seconds);
$dateTimeToDiffAgainst = new DateTime(
$date, $time, $timeZone
);
$dateInverval = $dateTimeHandler->diff($dateTimeToDiffAgainst);
$dateTimeHandler = new DateTimeHandler();
$dateTimeHandler->setTestNow(); //freezes time
$dateTimeHandler->getTime(); // returns the Time, setTestNow() was called at.