How can I check if the current date/time is past a set date/time?
date, datetime, php
Solution
You can use the `DateTime` class as such:
if (new DateTime() > new DateTime("2010-05-15 16:00:00")) {
# current time is greater than 2010-05-15 16:00:00
# in other words, 2010-05-15 16:00:00 has passed
}
The string passed to the DateTime constructor is parsed according to these rules.
Problem
I'm trying to write a script that will check if the current date/time is past the `05/15/2010 at 4PM` How can I use PHP's date() function to perform this check?