var_dump(strtotime("2012-W07 Monday"));
returns int 1329170400
on my local computer (PHP Version 5.3.4) but on the server (PHP Version 5.1.6) it returns
bool(false)
Some other formats like "today", "now" etc. work properly on both sides. Is it because of php versions, or what else could be wrong?
I would expect this to be related to a minor feature improvement or a fixed bug. Not all updates/bugfixes make it to the PHP docs.
I would test it for you, but don't have an install lower than 5.3.1 available.
I think your best bet would be to somewhere grab a default PHP 5.1.6 and test on your local machine or another server. My bet is that it would fail there as well.
You can use 'YYYY-MM-DD'
format with strtotime() and this format should work in all versions.
For the most stable behavior, I recomend passing only widely-used date-time formats to strtotime(). Be aware strtotime() expects a date separated by '/'
to be in 'MM/DD/YYYY'
format, which is the American order for dates. Europe uses a different order separated by '/'
.