Jump to content

issues with DATE_FORMAT


nubble

Recommended Posts

Can't seem to get this bugger working.  I'm trying to display the date as M d Y - but it just keeps showing up as Y M d on my php page.

I'm using

$sql = "SELECT `snakeID`, `date`, `weight`, DATE_FORMAT(date, '%M %d %Y') FROM `weights` WHERE `snakeID` LIKE '$critter' ORDER BY date DESC";

and here's the page - as you can see, not working so good :(

[url=http://sprucenubblefarm.com/chondros/TI05J01_weights.php]http://sprucenubblefarm.com/chondros/TI05J01_weights.php[/url]

I am pretty new at this, I'm sure I'm doing something retarded.

Any help would be great!

Amy
Link to comment
https://forums.phpfreaks.com/topic/27608-issues-with-date_format/
Share on other sites

Try
[code]$sql = "SELECT `snakeID`, `weight`, DATE_FORMAT(date, '%M %d %Y') AS `date` FROM `weights` WHERE `snakeID` LIKE '$critter' ORDER BY date DESC";
[/code]

You are pulling 2 dates from youe select statement. I'm guessing you are using $row['date'] which is the unformated date from your select.

Archived

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

×
×
  • Create New...

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.