Skip to content

Instantly share code, notes, and snippets.

@aiwas
Last active December 16, 2015 11:08
Show Gist options
  • Save aiwas/5424920 to your computer and use it in GitHub Desktop.
Save aiwas/5424920 to your computer and use it in GitHub Desktop.
for old version
<?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