hello all,
here is my scripts
function date_diff($datenow, $datelast) {
$s = strtotime($datenow)-strtotime($datelast);
$d = intval($s/86400);
$s -= $d86400;
$h = intval($s/3600);
$s -= $h3600;
$m = intval($s/60);
$s -= $m*60;
return array("d"=>$d,"h"=>$h,"m"=>$m,"s"=>$s);
}
$masa = "20020726 17:58:22";
$masa2 = "20020724 15:50:55";
$date_diff = date_diff($masa,$masa2);
echo "date diferent from $masa to $masa2 is<br>
day = ".$date_diff["d"]."<br>
hour = ".$date_diff["h"]."<br>
min = ".$date_diff["m"]."<br>
sec = ".$date_diff["s"]."<br><br>";
my scripts do fine with this result
date diferent from 020726 17:58:22 to 020724 15:50:55 is
day = 2
hour = 2
min = 7
sec = 27
but i have a problem how to insert and retrieve the value of day, hour, min and second into duration field because the datatype of the field is "number".
did anybody has any suggestion about this
problem??
please do not suggest me to change the datatype into something else...🙂
thanx in advance..