I’m trying to format some dates in PHP (i’m a Coldfusion programmer, so the syntax is similar, but i’m stuck!).
The dates are formatting perfectly into the display I want. However, they all return 1st Jan 1970.
Can anyone shed any light on this?
For background, I am pulling a date from a datetime column in mySQL. The raw date i’m trying to format is….
2010-04-03 00:00:00
Here is the line of code i’m using….
$xml_output .= "\t\t<eventdate>" . date("l jS F", $row['event_date']) . "</eventdate>\n";
I want it to display as: Saturday 3rd April
Any help would be appreciated!
Simon
The second parameter to
date()needs to be a UNIX timestamp.Convert your date string it into a timestamp first using
strtotime():Manual pages:
date()
strtotime()