drranch Posted September 6, 2006 Share Posted September 6, 2006 I have three date fields I need to display on my mysql query results page and I can't seem to find how to display them in the %M%d%Y format rather than the mysql format of yyyy-mm-ddhere is my query....I also want to pull all other fields from this table as well.$query_rscars = sprintf("SELECT * FROM cars WHERE name = '$carlist'", $name_rscars,$name_rscars);I've read its best done with the mysql script and not the PHP script. Link to comment https://forums.phpfreaks.com/topic/19857-resolved-need-date-format-assistance/ Share on other sites More sharing options...
drranch Posted September 6, 2006 Author Share Posted September 6, 2006 Okkkkkk I figured this out ;Dquery reads...(red is the code I needed assistance with)$query_rscars = sprintf("SELECT *, [color=red]DATE_FORMAT(purchase_date, "%%b %%d %%Y") AS fpurchasedate, DATE_FORMAT(sell_date, "%%b %%d %%Y") AS fselldate, DATE_FORMAT(service_date, "%%b %%d %%Y") AS fservicedate[/color] FROM cars WHERE name = '$carlist', $name_rscars, $name_rscars");HTML results page reads.....<?php echo $row_rscars['fpurchasedate']; ?><?php echo $row_rscars['fselldate']; ?><?php echo $row_rscars['fservicedate']; ?>Web page view....purchase date: Aug 22, 2005sell date: Aug 5, 2006servicedate: Jul 17, 2006 Link to comment https://forums.phpfreaks.com/topic/19857-resolved-need-date-format-assistance/#findComment-86912 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.