Jump to content


Photo

[RESOLVED] need date format assistance


  • Please log in to reply
1 reply to this topic

#1 drranch

drranch
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 06 September 2006 - 03:53 AM

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.



#2 drranch

drranch
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 06 September 2006 - 05:44 AM

Okkkkkk  I figured this out ;D

query reads...(red is the code I needed assistance with)
$query_rscars = sprintf("SELECT *, 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  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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users