Jump to content

[SOLVED] Date Formatting Discrepancy


broheem

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.

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.