Created
August 1, 2012 08:52
-
-
Save zaru/3225150 to your computer and use it in GitHub Desktop.
日付の差を計算する
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 | |
//日付の差を月単位で計算する(PHP>=5.3) | |
$date1 = new DateTime('2012-08-01'); | |
$date2 = new DateTime('2013-02-24'); | |
$interval = $date1->diff($date2); | |
$diffMonth = $interval->y * 12 + $interval->m; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment