I'm looking for a function like date_diff that I can use for 5.2.12? I can't find one. Is there one I didn't see that will work. The point of this is because I'm trying to see if there has been 10 minutes expired between two datetime variables.
Asked
Active
Viewed 278 times
1
-
u have in http://us3.php.net/manual/en/function.date-diff.php some comments of how o use in php < 5.3 – Haim Evgi Jun 12 '11 at 06:05
2 Answers
0
if date_diff itself does not work, it is most likely due to the date objects not being setup properly. However if you want a custom function that does the same, you can take a look at...
How to calculate the difference between two dates using PHP?

Community
- 1
- 1

PicoCreator
- 9,886
- 7
- 43
- 64
-
-
Scroll down, about 3 answers, it showed a version that include time (even in seconds) – PicoCreator Jun 12 '11 at 06:09
0
How about this:
if ( strtotime($newest_date) - strtotime($oldest_date) > 600 )
{
echo '10 minutes has elapsed';
}
Where $newest_date is the most recent of the 2 dates and $oldest_date is the lowest. The 600 value is obtained by the following calculation: 10 minutes * 60 seconds = 600.

Francois Deschenes
- 24,816
- 4
- 64
- 61