Last active
December 16, 2015 11:08
-
-
Save aiwas/5424920 to your computer and use it in GitHub Desktop.
for old version
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 | |
#xxxx-yy-zz形式の文字列から残り日数を求める | |
function getrest_prs($str) { | |
date_default_timezone_set('Asia/Tokyo'); | |
$a = date_parse($str); | |
$year = $a['year']; $month = $a['month']; $day = $a['day']; | |
$t1 = mktime(0,0,0,$month,$day,$year); | |
$t2 = time(); | |
$one_day = 60*60*24; | |
$one_day_trim = ceil(($t1-$t2) / $one_day); | |
return $one_day_trim ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment