How do I get the difference between a mysql timestamp and the php current time?
Translations
Englishالعربية
български
català
中文
čeština
dansk
Nederlands
eesti
suomi
français
Deutsch
Ελληνικά
עברית
हिंदी
magyar
Bahasa Indonesia
italiano
日本語
한국어
latviešu
lietuvių
norsk
polski
Português
română
русский
slovenčina
slovenski
español
svenska
ไทย
Türkçe
українська
Tiếng Việt
The question i guess is kind of 2 questions:
- How do i even GET the current time in php and in a format that is easily compared to and
- 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 bzupnick (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 Jesse Bunch
Find More Answers