about date
Posted: Thu Apr 22, 2004 3:48 am
my prog compare two times input by user in a format 00:00:00 and its 24 hrs format...right now it only check whether 20:00:00 is before 21:00:00 but now i want to make it such a way that it can also tell me that 20:00:00 of first day is before 19:00:00 of second day...my present code is
in other words i need some way to increment $day so that it can handle days as well..
Code: Select all
<?phpfunction compareTime($str) {
$day=1;
$arr=split(":",$str);
global $time;
if(isset($time))
{
$prev_time=$time;
$time=mktime($arr[0],$arr[1],$arr[2],1,$day);
if($time<$prev_time)
return 1;
}
else {
$time=mktime($arr[0],$arr[1],$arr[2],1,$day);
return 1;
}
}
?>