when i want to convert a date so that i can “feed” it to MySQL (mm/dd/yyyy -> yyyy-mm-dd) this preg_match works fine
$new_date = preg_replace("!([01][0-9])/([0-9]{2})/([0-9]{4})!", "$3-$1-$2", $data[$c]);
with dates like
04/02/2012, 12/31/2012
but it fails when i get input like
12/1/2011, 1/4/2011
how to fix it due to i’m total noob to regex… 🙁
Thanks a lot for your help.
Try:
\dmeans a digit, and I think it’s handier than[0-9], and they are almost equivalent.