tags:

views:

70

answers:

2

I thought strtotime() would convert a "string" into a timestamp. If I add on to the time, it works fine, but if I try to subtract, it doesn't. Does anyone know a workaround?

Thanks in advance.

+1  A: 

It seems to work fine for me...

echo strtotime("-5 hours");

Result:

1282061972
Mark Byers
Ditto. (You beat me to it...)
Stephen
+1  A: 

I recommend reading Derick Rethans's excellent guide on Date and Time, http://derickrethans.nl/talks/time-zendcon9.pdf, explanatory slides start at slide 16.

He's the author of PHP's date and time functions and recommends that you use the DateTime classes if possible.

asnyder