check remain date
Posted: Thu Dec 03, 2009 10:55 pm
this is my code: which used to calculate the remain day from input date imcompare with current time.
It's weird that it isnt working since a similar code (used to see if the input date is 10days ahead of current date is working)
Code: Select all
$text2="2009-12-29";
$text4=explode("-",$text2);
if(sizeof($text4)!=3)
{
return false;
}
$text2 = strtotime($text2);
//plus 10 days prequisites
$text3 = strtotime(date("Y-m-d"))+60*60*24*10;
if($text3-$text2>=0)
{
$day=($text3-$text2)/(60*60*24);
echo "hi".$day;
}
else
{
$day=($text3-$text2)/(60*60*24);
echo "he".$day;
}Code: Select all
<?
function isLater($text2){
$text4=explode("-",$text2);
if(sizeof($text4)!=3)
{
return false;
}
$text2 = strtotime($text2);
//plus 10 days prequisites
$text3 = strtotime(date("Y-m-d"))+60*60*24*10;
if($text3-$text2>=0)
{
return false;
}
else
{
return true;
}
}
?>