echo date("m", strtotime("january"));
Returns 01 as expected
echo date("m", strtotime("february"));
But this returns 03
Anyone else encountered this problem?
PHP Version 5.1.6
Today is the 29th. There is no 29th in February this year and because you're not specifying a day in February, it's using "today". The strtotime
function uses relative dates so the 29th of February is basically the 1st March this year.
To solve your problem:
echo date("m", strtotime("February 1"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With