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.
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.
It seems to work fine for me...
echo strtotime("-5 hours");
Result:
1282061972
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.