The below given php script count and display the no of days to a specific date in the future...
< ? php
$d=date("d");
$m=date("m");
$y=date("Y");
// Change this to the day in the future
$dd = 13;
// Change this to the month in the future
$mm = 05;
// Change this to the year in the future
$yy =2011;
/*COUNT THE NO OF DAYS TO THE DATE IN THE FUTURE */
$dy=$yy - $y;
if ($dy ==0)
{ $dm = $mm - $m;
$days=(($dm-1)*30)+(30-$d)+$dd+($dm/2);
echo "\r\n There are $days days remaining \r\n";
}
else
{
$days=(($dy-1)*365)+(30-$d)+((12-$m)*30)+(($mm-1)*30)+$dd+($dy*4);
echo " There are $days days remaining ";
}
?>
< ? php
$d=date("d");
$m=date("m");
$y=date("Y");
// Change this to the day in the future
$dd = 13;
// Change this to the month in the future
$mm = 05;
// Change this to the year in the future
$yy =2011;
/*COUNT THE NO OF DAYS TO THE DATE IN THE FUTURE */
$dy=$yy - $y;
if ($dy ==0)
{ $dm = $mm - $m;
$days=(($dm-1)*30)+(30-$d)+$dd+($dm/2);
echo "\r\n There are $days days remaining \r\n";
}
else
{
$days=(($dy-1)*365)+(30-$d)+((12-$m)*30)+(($mm-1)*30)+$dd+($dy*4);
echo " There are $days days remaining ";
}
?>
No comments:
Post a Comment