1

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.

Jeff Davidson
  • 1,921
  • 7
  • 36
  • 60

2 Answers2

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
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