There is a easy method for find date difference in php.
But this method didn't work after i hosted my files.
So i came up with following. it is generating difference in days. but you can use other calculations for generate Months, years. This is a simple method.
$from = date("Y-m-d",strtotime('2011-04-01'));
$to= date("Y-m-d",strtotime('2011-04-06'));
$diff = strtotime($from )-strtotime($to);
echo floor($diff / (60*60*24));
$to= date("Y-m-d",strtotime('2011-04-06'));
$diff = strtotime($from )-strtotime($to);
echo floor($diff / (60*60*24));
60*60*24 = Generate Days (86400)
"year" = 29030400,
// seconds in a year (12 months)
"month" = 2419200, // seconds in a month (4 weeks)
"week" = 604800, // seconds in a week (7 days)
"day" = 86400, // seconds in a day (24 hours)
"hour" = 3600, // seconds in an hour (60 minutes)
"minute" = 60, // seconds in a minute (60 seconds)
"second" = 1 // 1 second
// seconds in a year (12 months)
"month" = 2419200, // seconds in a month (4 weeks)
"week" = 604800, // seconds in a week (7 days)
"day" = 86400, // seconds in a day (24 hours)
"hour" = 3600, // seconds in an hour (60 minutes)
"minute" = 60, // seconds in a minute (60 seconds)
"second" = 1 // 1 second
Honestly say,great blog with good picture gallery and also detail explain every topic for the viewers of this blog,I like subscribe this blog. Thanks
ReplyDelete