Can someone help and give a solution to compare two times which are in the following format when received: 12:20 AM.
I have two time fields in my script which are meant to be stored in the database after validation, but after validation that the format is in correct order i want to do comparison between those two fields.
The comparison i want to do is to check if the second field not overlapping the first one.
For Example:
The first variable is named
$timeStart, and holding the time value of = “05:30 PM”.The second is named
$timeEnd, holding a value of = “4:00 PM”.
Now, i want to do a comparison to see if the $timeEnd is before $timeStart (also putting into consideration AM/PM when comparing) if it is i dont want to echo an error, otherwise continue with the script.
I’m doing it for a Event Script, so timing has to be right 🙂 $timeEnd has to be after $timeStart.
I sure do hope i explained it clear enough 🙁
Thanks for taking the time to read my complicated gibberish 🙂
1 Answer