Reputation: 3744
I have to validate some values vs the last six hours, so let it like:
$last_six_hours = (time() - (3600 *6));
If I have to compare vs a integer like 16hs, what is the best approach to do this?
Upvotes: 0
Views: 51
Reputation: 219804
strtotime()
takes relative amounts and returns a unix timestamp:
$four_o_clock = strtotime('16:00:00');
if ($sometimestamp > $four_o_clock) {
// it happened after 16:00:00 today
}
Upvotes: 3