I have a field that has time and date in following format
2010-03-26 10:06:11
What I need is that if this time is within 4 hours of current time then show but if its over 4 hour then done show this record.
thanks
I have a field that has time and date in following format
2010-03-26 10:06:11
What I need is that if this time is within 4 hours of current time then show but if its over 4 hour then done show this record.
thanks
$ts = strtotime($value);
$curtime = time();
if (($ts > $curtime - 4*3600) && ($ts < $curtime + 4*3600)) {
//show
}
else
//don't show
You can also make a one-side comparison by choosing only one of the conditions (it isn't clear what you want from the question).