views:

23

answers:

2

This is what I need to do: I need to perform a PHP operation, then retrieve how long ago the last time the operation was performed was. I have it all figured out, except one thing - how do I find the difference between two date/times? Or, is there an easier way to do this? (This is based in Wordpress, so I'm using wp_options to store the date/time data.)

+1  A: 

If you're using PHP 5.3, take a look at DateTime::diff.

Artefacto
+2  A: 

If you just need it in seconds, convert both to seconds (use the strtotime() PHP function), then subtract one from the other.

Kerry