hi, is there any easy to validate a time field entry against the current date and time?i get date and time entry from an user in two separate fields. I used jquery date picker and time picker for both. with the date I had the option to show current date and future dates and not the past dates so it's good. with the time field i have to show all the time but want to somehow validate to see if the time is already gone for that date.I can o away from jquery and just use php if possible. any ideas?g
+2
A:
You can do
$ispast = strotime($field_value) < time();
This will tell if the given time is in the past. The only requirement is that $field_value
is in a format that strtotime
recognizes. This will interpret the date in the default timezone you have set (see date_default_timezone_set
).
Artefacto
2010-08-15 17:52:02