Jump to content

Recommended Posts

I'm trying to format a date which is pulled from MySQL.  I have a couple of record sets being looped through.  All of them use the following code:

 

echo date('M m, y', strtotime($result['date']));

 

The first record set displays the correctly formatted date.  But the last one doesn't display the correct date instead it's stuck on on 'Dec 12, 07'.  The values for the last data set are (when outputted without formatting):

 

2007-12-13 15:23:48
2007-12-31 07:06:01

 

So the values are coming through correctly but when I add the code above to format them they get switch to displaying 'Dec 12, 07' for both.  Am I doing something wrong here?  Thanks!

Link to comment
https://forums.phpfreaks.com/topic/83843-solved-date-formatting-discrepancy/
Share on other sites

Wow, I'm an idiot.  I knew it must have been something simple.  It's odd I didn't catch on with the others... they were trivial dates so I when they appeared to be displaying correctly I assumed they were.  Thanks for the quick reply!  Take care, Happy New Year.

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.