I have a record returned from MySQL that has a datetime field. What I want to do is take this value and see if it is older then 24 hours, I presume using PHP’s time() to get the current time.
At the moment if I echo them out I get:
1276954824 this is php's time()
2010-06-19 09:39:23 this is the MySQL datetime
I presume the top one is a unix time? Have been playing around with strtotime but with not much success..
ANy help welcome!
No success?
gives me
(
mktime(9, 39, 23, 6, 19, 2010)gives the same time, so the parsing works correctly)To get the differences in seconds, you can substract the timestamps, e.g.
If the differences is larger than 86400 (60*60*24) seconds, then the timestamps are more than one day apart: