...

View Full Version : Format date



tdprout
10-16-2012, 11:19 PM
I currently have this




("SELECT * FROM material WHERE status='$status' AND category='$category' ORDER BY `material`.`title` ASC ");

Where do you stick this:



DATE_FORMAT(`date`,'%m/%d/%Y') AS showdate


While still using *? Or do I have to name all of the columns?

Fou-Lu
10-16-2012, 11:58 PM
While you *should* name all the fields you want, it is not required. You can simply select the date format in combination with the *: SELECT *, DATE_FORMAT(`date`, '%m/%d/%Y') AS showdate. You'll still have the `date`, but also the `showdate` fields returned.

nani_nisha06
10-17-2012, 09:19 AM
I currently have this




("SELECT * FROM material WHERE status='$status' AND category='$category' ORDER BY `material`.`title` ASC ");

Where do you stick this:



DATE_FORMAT(`date`,'%m/%d/%Y') AS showdate


While still using *? Or do I have to name all of the columns?


Hope below post will help you ....

http://www.codingforums.com/showthread.php?t=275610



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum