This topic is locked

How to check for current time

4/25/2008 6:41:10 AM
PHPRunner General questions
J
jack knowles author

Hi Forum,
I have the following logic in Add Page, Before record added Event:
I need a way to check $starttime => Current Time.
i.e. if $starttime = 08:00:00 and current time = 11:40:00 then session error message will apply.
Thanks in advance
JK
// CURRENT DATE VALIDATION ROUTINE

$temp = now();

$dummydate = substr($temp,0,10);

$dummydate1 = $dummydate . ' 00:00:00';

$arr = db2time($dummydate1);

$nowdate = mktime($arr[3],$arr[4],$arr[5],$arr[1],$arr[2],$arr[0]);

$start = "";

$end = "";[/color]
if ($values["seller_collection_date"]==null) {

}else{

$arr = db2time($values["seller_collection_date"]);

$start = mktime($arr[3],$arr[4],$arr[5],$arr[1],$arr[2],$arr[0]);

}
//END DATE ROUTINE

if ($values["buyer_collection_date"]==null) {

}else{

$arr = db2time($values["buyer_collection_date"]);

$end = mktime($arr[3],$arr[4],$arr[5],$arr[1],$arr[2],$arr[0]);

}[/color]
if ($values["seller_collection_time"]==null) {

}else{

$starttime = $values["seller_collection_time"];

}
if ($values["buyer_collection_time"]==null) {

}else{

$endtime = $values["buyer_collection_time"];

}
if (($start >= $nowdate) && ($start < $end)) {

return true;

} elseif (($start == $end) && ($starttime < $endtime)) {

return true;

} else {

$_SESSION["message"] = "Check Time / Date Combination ...";

return false;

}

J
jack knowles author 4/28/2008

Hi Forum,
A little help here would be much appreciated.
Thanks in advance
JK