Reputation: 13299
I was working with a project in Php and I noticed that date (and time too) return wrong time. At first it seemed the wrong timezone, but later I noticed that there is not one or more hours of difference (I'm working on localhost) with system clock, but about 28 minutes... That's weird.. what could it possibly be?
Upvotes: 2
Views: 4372
Reputation: 212522
If you're using "M" or "m" for minutes, then you're actually displaying month of year. "i" is used for minutes.
Upvotes: 36
Reputation: 19999
PHP Date() functions are based on the locale settings of the server, so I would make sure that the system current time is set correctly.
On a *nix system you can do the following:
# Check current time
$ -> date
Tue Mar 6 23:48:23 UTC 2012
If you are not using the correct timezone, you can do:
$ -> rm -f /etc/localtime
# You can use any timezone you wish, I prefer UTC
$ -> ln -sf /usr/share/zoneinfo/UTC /etc/localtime
If you need to correct your system time:
$ -> ntpdate -b pool.ntp.org
Upvotes: 3