Jump to content


This topic is now archived and is closed to further replies.


[RESOLVED] need date format assistance

Recommended Posts

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-dd
here 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.

Share this post

Link to post
Share on other sites
Okkkkkk  I figured this out ;D

query 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, 2005
sell date: Aug 5, 2006
servicedate: Jul 17, 2006

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.