PHP code example of henzeb / datetime
1. Go to this page and download the library: Download henzeb/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/ */
henzeb / datetime example snippets
use Henzeb\DateTime\DateTime;
DateTime::now();
DateTime::now(new DateTimeZone(...));
DateTime::new('2022-04-25');
use Henzeb\DateTime\DateTimeImmutable;
DateTimeImmutable::now();
DateTimeImmutable::now(new DateTimeZone(...));
DateTimeImmutable::new('2022-04-25');
use Henzeb\DateTime\DateTime;
DateTime::setTestNow('now'); // freezes time
DateTime::setTestNow('1999-01-01');
DateTime::setTestNow(new DateTime('1999-01-01'));