I'm trying to use strtotime to convert date strings in the format Jan 14th 2011 to the format 2011-01-14 but it's not working.
Is this format not suitable for strtotime and if so, how can I convert it. The month is always in 3-letter format, like Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
$date_str = "Jan 14th 2011";
$date = date_parse_from_format('M jS Y', $date_str);
echo $date->format('Y-m-d');
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