Need help with dates

In the database I see this for a date:

2011-03-01 04:15:05

I then use this code to make it look nice:

$dateAdded = date(‘M j Y’, strtotime($dateAdded)) . ‘<br />’ . date(‘g:i a’, strtotime($dateAdded));

But it won’t show pm for the time. Here is how it looks on my webpage::

Mar 1 2011
11:49 am

What do I need to do so the AM or PM will correctly show?



Well you either use a for lowercase or A for uppercase.

You are clearly using it correctly, you even show how it looks on your webpage as using it so I’m at a loss as to how you say its not showing up?

Also what does this have to do with your database? - You state you’ve got a date/time stamp there but you don’t explain how its related to the date and time display on your webpage.

Also can you please show us your actual code? - wrapped in php tags too.

I see nothing wrong with your code but you could tidy that line up and stop calling strtotime twice

$dateAdded = date('M j Y \\<\\b\\r \\/\\> g:i a', strtotime($dateAdded))

I saw your code it is correct.maybe something wrong with your host.