I have the following problem. I am trying to compare two datetime values in PHP but the calculation is invalid. There is about 8 hours of difference. I am on my development machine using WAMPServer
if(strtotime($date_time_from_db) < time())
{
// do something
}
The datetime value in the database is in the following format: Y-m-d H:i:s. How can I do this accurately? Also, is using time() a good idea? What happens if the user changes the time on their machine?
Thanks very much!
date_parse_from_format('Y-m-d H:i:s', $date_time_from_db)give you the correct time?