Forum Moderators: coopster
start Date: 2008-05-12 20:32:17
Expiry Date: 2008-08-18 00:17:54
Also,if i convert the above format to a human readable one,can i still get the number of days difference?
I found a snippet code here,but could not successfully apply it to my case
[weberdev.com...]
Depending on where you're getting the dates from it may be better to use MySQL's timediff() [dev.mysql.com] function.
<?
//getting days in between 2 timestamps;
$start = "2008-05-12 20:32:17";
$end = "2008-08-18 00:17:54";echo "\$start: ".strtotime($start)."<br>";
echo "\$end: ".strtotime($end)."<br>";
$difference = (strtotime($end)-strtotime($start));
echo "\$difference: $difference<br>\n";
$days = $difference/24; //hours in one day
$days = $days/60; //minutes in one hour
$days = $days/60; //seconds in one minute
$days = ceil($days); //rounding up
echo "\$days in between: $days";
?>