Reputation: 11
I have 2 Timestamps like
2015-06-26 17:43:18
and 2015-06-26 17:22:08
.
How can I check whether the first timestamp is earlier than the second?
Upvotes: 0
Views: 413
Reputation: 219814
Just use DateTime()
objects which are comparable:
$date1 = new DateTime('2015-06-26 17:43:18');
$date2 = new DateTime('2015-06-26 17:22:08');
if ($date1 < $date2) {
// $date1 is earlier than $date2
}
Upvotes: 2