tags:

views:

94

answers:

2

When it's pulled from the db, it comes out like this: 2010-02-28 10:00:00

I'm formatting it (yes, I know that it's better to just do it in the query, but I don't have that option right now):

date('l F d, Y h:m A', strtotime($row['start']));

But, no matter what, it outputs like this: Sunday February 28, 2010 10:02 AM

Any idea why it's adding those two minutes?

+10  A: 

m in date means number of the month, not minute. What your looking for is i. Like so:

date('l F d, Y h:i A', strtotime($row['start']));

You should really check the docs here.

Oh, and, also, it's not better to format the date in the query, since your query needs not know the locale that you're using.

Juan
Next month he would come back saying the PHP is off by 3 minutes. :)
Chacha102
+1. I'd also vote up an answer just saying: RTFM (if it were first, of course)
Milan Babuškov
lol RTFM seemed a little harsh, but I'd vote up that answer :P
Juan
But its better to do the conversion from internal timestamp format to `UNIX_TIME` in the query as it is locale independent. The internal timestamp format isn't.
Andrew Moore
Thanks for that... And for not being a snarky asshole.
andy787899
+1  A: 

Use i for minutes, m is for month, so the 02 is the month.

Nate Heinrich