Created
February 23, 2013 17:11
-
-
Save shigemk2/5020498 to your computer and use it in GitHub Desktop.
DateIntervalを使ってみよう
This file contains 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 | |
$date = new DateTime('2000-01-20'); | |
$date->sub(new DateInterval('P12M')); // 12ヶ月前 | |
echo $date->format('Y-m-d') . "\n"; // 1999-01-20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment