Given a date string in the format m-d-Y (e.g, "12-09-2011") how can I display it in the format "m/d/Y" WITHOUT resorting to regular expressions.
Just in case you missed it: without using regular expressions.
I would prefer to use DateTime::createFromFormat()
for this problem, but the server I am using currently doesn't have 5.3.0 on it.
I'd also prefer using date('m/d/Y', strtotime("12-09-2011"))
but strtotime()
doesn't recognize that format properly. It confuses the day and month.