Comparison of date and time in php I remember that in php, the date and time strings can be directly compared to the size, for example, & quot; 2011-11-2:58:18 am & quot; & lt; & quot; 2011-11-am & quot; remember that php can be used like this, but the comparison result is always incorrect if you encounter a problem today. Finally, change it to strtotime (& quot; 2011-11-Comparison of date and time in php
I remember that in php, the date and time strings can be directly compared, for example, "9:58:18 am" <"10:00:00 am". remember that php can be used like this, however, if you encounter a problem today, the comparison result is always incorrect. Finally, change it to strtotime ("9:58:18 am") <strtotime ("10:00:00 am") to compare the timestamp size.
------ Solution --------------------
Where does PHP say that the time can be directly compared with the size ???
This is just a string comparison.
"2011-11-21 9:58:18 am" <"2011-11-21 10:00:00 am"
No
"2011-11-21 09:58:18 am" <"2011-11-21 10:00:00 am"
The correct time comparison means that after strtotime is converted to a unix timestamp
------ Solution --------------------
The database can directly compare the processing methods of. php during the time period to convert them into timestamps, which is simple, convenient, and convenient.
------ Solution --------------------
In php, change to the number of seconds for comparison.
------ Solution --------------------
Posting rate: 0%
Total posts: 6
Normal close: 0
Who will reply to this posting rate?
------ Solution --------------------
Strtotime conversion is the correct idea, otherwise it can only be separated and compared.