In my mySQL database I have a field called FlowerOpen that is in the DATE format (YYYY-MM-DD) in my php script, I want to convert it so the user sees Monday, May 28, 2012
I keep finding explanations on how to convert DATETIME to DATE but not DATE to DATETIME
I tried converting the date with the following command:
$Date = DATE_FORMAT($ResultsLists['FlowerOpen'],'%W, %M %e, %Y');
I keep getting the following error:
Warning: date_format() expects parameter 1 to be DateTime, string given in
C:\xampp\htdocs\Orchid\viewPlantInfo.php on line 383
So I tried converting the FlowerOpen to DATETIME and then format it using:
$Date = date("Y-m-d H:i:s", strtotime($ResultsLists['FlowerOpen']));
$Date = DATE_FORMAT($Date,'%W, %M %e, %Y');
but I got the same error message.
I also tried
$Date = SELECT CAST($ResultsLists['FlowerOpen'] AS DATETIME);
$Date = DATE_FORMAT($Date,'%W, %M %e, %Y');
but I got the error
Parse error: syntax error, unexpected T_STRING in
C:\xampp\htdocs\Orchid\viewPlantInfo.php on line 382 (the CAST line)