Created
August 2, 2016 04:15
-
-
Save b0n/95f2332b8a0acb118434bf6213a0b90b to your computer and use it in GitHub Desktop.
Chronos failures add months tesst.
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 | |
/** | |
* @url http://scriptworks.jp/blog/2011/12/how_to_avoid_pitfall_of_php_datetime/ | |
*/ | |
require 'vendor/autoload.php'; | |
use Cake\Chronos\Date; | |
$today = new Date('2011-01-31'); | |
echo $today . PHP_EOL; | |
echo $today->modify('+1 months') . PHP_EOL; | |
// 2011-01-31 | |
// 2011-03-03 | |
$today2 = new Date('2011-03-31'); | |
echo $today2 . PHP_EOL; | |
echo $today2->modify('-1 months') . PHP_EOL; | |
// 2011-03-31 | |
// 2011-03-03 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment