Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.