I'm picking up a datetime from a database and need to check whether it is greater than 30 minutes old.
e.g.
$date = 2010-11-24 14:12:55
If $date < (now - 30 minutes) then do this
else
do this
but I'm struggling to see how to do this, I can only find examples of static dates e.g. day1 - day2.
I'm sure this must be relatively straight forward.
date time query
Moderator: General Moderators
Re: date time query
found a way to do it:
Code: Select all
$half = time()-1800;
$quart = time()-900;
$con = strtotime($Aresult['ConnectedAt']);
IF ($con < $half) {
$col = $colour1;
}elseif ($con < $quart) {
$col = $colour3 ;
}else{
$col = $colour2;
};