Created
August 2, 2016 03:05
-
-
Save b0n/c5514dbaf02d15bedda0d750c9280724 to your computer and use it in GitHub Desktop.
chronos has two statuses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
use Cake\Chronos\Chronos; | |
printf("Now: %s" . PHP_EOL, Chronos::now()); | |
use Cake\Chronos\Date; | |
$today = new Date(); | |
echo $today . PHP_EOL; | |
echo $today->modify('+3 hours') . PHP_EOL; | |
echo $today->modify('+3 days') . PHP_EOL; | |
echo $today->modify('+3 weeks') . PHP_EOL; | |
echo $today->modify('+3 months') . PHP_EOL; | |
echo $today . PHP_EOL; | |
echo "-- to Mutable --" . PHP_EOL; | |
$today2 = $today->toMutable(); | |
echo $today2 . PHP_EOL; | |
echo $today2->modify('+3 hours') . PHP_EOL; | |
echo $today2->modify('+3 days') . PHP_EOL; | |
echo $today2->modify('+3 weeks') . PHP_EOL; | |
echo $today2->modify('+3 months') . PHP_EOL; | |
echo $today2 . PHP_EOL; | |
echo "-- to Immutable --" . PHP_EOL; | |
$today3 = $today2->toImmutable(); | |
echo $today3 . PHP_EOL; | |
echo $today3->modify('+3 hours') . PHP_EOL; | |
echo $today3->modify('+3 days') . PHP_EOL; | |
echo $today3->modify('+3 weeks') . PHP_EOL; | |
echo $today3->modify('+3 months') . PHP_EOL; | |
echo $today3 . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment