The code:
$expiration_date = "24th Dec, 2012";
var_dump( date( 'Y-m-d', strtotime( $expiration_date )));;
The output:
string(10) "2011-12-24"
Why is PHP not parsing the year correctly (showing 2011 instead of 2012)?
PHP Version: 5.2.17 on Centos 5.7
strtotime()does not support the ordering of your date (see 2nd table). Use theDateTimeclass instead: