THINKPHP time comparison problem select a time period, such as 03:12:43 to 03:12:43 this time period of data, the front-end page is entered in the form of 2014-03-15, and the database is 03:12:43 this form, with more time and minutes, I added the field to the form 00:00:00, and then compared it with the time field of the database, it cannot be compared with the size. What is the correct comparison method?
Reply to discussion (solution)
Time comparison must be a unified type
Your database is datatime and the input is date.
Therefore, you need to convert datatime into date for comparison.
Date_format (time field, '% Y-% m-% d') =' $ iuput'
Yes.
To_days (time field) = to_days ('$ input ')
Time comparison must be a unified type
Your database is datatime and the input is date.
Therefore, you need to convert datatime into date for comparison.
Date_format (time field, '% Y-% m-% d') =' $ iuput'
Yes.
To_days (time field) = to_days ('$ input ')
The database field is datetime, which queries many records. Can I convert date to datetime?
No
The two data with different precision must be compared according to the low precision.
"; Echo" zero2 Time: ". $ zero2 ."
"; If (strtotime ($ zero1)
Yes, the landlord's method is correct.
The time is relatively consistent with the timestamp, so is the database...
Well, the method is correct. you don't need to change the time format to compare the quotation marks.