How do I get the difference between a mysql timestamp and the php current time?

The question i guess is kind of 2 questions:

  1. How do i even GET the current time in php and in a format that is easily compared to and
  2. Once i have that, i have a mysql timestamp in this format, 2011-06-30 04:33:00 , that I need to be compared to the php current time.

thank you so so much in advance, Binny

This question and answers originated from www.stackoverflow.com
Question by (6/28/2011 5:18:44 PM)

Answer

strtotime($query_result['timestamp'])

This will convert your MySQL timestamp value to the correct seconds since Jan 1, 1970 value. Then it's just a matter of subtracting the two to get the difference.

Answer by

Find More Answers
Related Topics  php  mysql  date  timestamp
Related Questions