php why does it keep adding 2 minutes?
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'开发者_StackOverflow]));
But, no matter what, it outputs like this: Sunday February 28, 2010 10:02 AM
Any idea why it's adding those two minutes?
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.
Use i for minutes, m is for month, so the 02 is the month.
精彩评论