Jump to content

formatting date


Recommended Posts

Having used unix timestamps in the past formatting the date used to be easy. But since converting to mysql DATETIME im struggling to format it properly. I basically pull the date from the database, convert it using strtotime(), then convert it to a date using date(). The problem is that when i use 'a' to display am/pm the time almost always says am. If the time is 11am then it will display 11am. If it's 12pm then it will display 12pm, but if it comes to 1pm and above it will revert back to 1am.


This is the date string I use:


date('jS M Y g:i a');


is this due to the fact that mysql DATETIME uses 24 hour clock ('H'), if so is there a way around this?


Link to comment
Share on other sites


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.