How does php determine whether the database time is greater than 24 hours? comparison between mydate and system time
How can I determine if it is more than 24 hours?
Reply to discussion (solution)
Compare with timestamp
24x3600
Time () + 60*60*24
What is mydate format? Use strtotime to convert to the unix timeline, and then follow the upstairs method. the current timeline is: time ()
$ Mydate = "09:29:48"; // $ mydate = "09:29:48"
$ Mydate = strtotime ($ mydate );
Echo $ mydate. "= ";
$ Nowdate = time () + 60*60*24;
Echo $ nowdate;
If ($ mydate> $ nowdate ){
Echo "> ";
} Else {
Echo "<";
}
?>
Why are the two values displayed as "<"
$ Mydate = "09:29:48 ";
$ Mydate = strtotime ($ mydate) + 60*60*24;
Echo $ mydate. "= ";
$ Nowdate = time ();
Echo $ nowdate;
If ($ mydate> $ nowdate ){
Echo "> ";
} Else {
Echo "<";
}
?>
The above should be correct.
Soy sauce!