hi i tried to get time difference between current date and 2011.
i used following code.but i didn’t get correct result.
result is 838:59:59 is there any limit with this function could any one help.
<?php
date_default_timezone_set(“America/Los_Angeles”);
$dt1=date(‘Y-n-j H:i:s’);
$dt2=“2011-01-01 00:00:00”;
$rs=mysql_query(“select timediff(‘$dt2’,‘$dt1’)”);
$result=mysql_result($rs,0);
echo $result;
?>
Why don’t you calculate it directly in PHP?
date_default_timezone_set("America/Los_Angeles");
$dt1 = date('Y-n-j H:i:s');
$dt2 = "2011-01-01 00:00:00";
$result = strtotime($dt2) - strtotime($dt1);
echo $result;
Now the variable $result will hold total difference in seconds and now you can calculate to find year/months/days and times.