Posted By: Anonymous
I am trying to convert a date from
dd-mm-yyyy (but not in SQL); however I don’t know how the date function requires a timestamp, and I can’t get a timestamp from this string.
How is this possible?
$originalDate = "2010-03-21"; $newDate = date("d-m-Y", strtotime($originalDate));
Note that this was a quick solution to the original question. For more extensive conversions, you should really be using the
DateTime class to parse and format 🙂