How to parse a date string in PHP?

Issue

With a date string of Apr 30, 2010, how can I parse the string into 2010-04-30 using PHP?

Solution

Try strtotime() to convert to a timestamp and then date() to get it in your own format.

Answered By – zaf

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published