PHP default time zone

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
implications
Forum Commoner
Posts: 25
Joined: Thu Apr 07, 2011 3:59 am

PHP default time zone

Post by implications »

Where does PHP fetch its time data from? My computer is in the HK time zone, but when I use NOW() to fetch the time of when a user submits something, the time submitted is different from the actual time. Does it fetch the data is accordance to the time zone that has been set for your computer or does it randomly assume where you're from by your IP address or what.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: PHP default time zone

Post by Weirdan »

from date.timezone ini parameter. If it's not set in php.ini you need to do that (or set it at runtime via date_default_timezone_set() function.

PS: NOW() is an sql function - has nothing to do with php. If that's mysql you would need to set timezone on connection with 'set time_zone="your/timezone"' statement.
implications
Forum Commoner
Posts: 25
Joined: Thu Apr 07, 2011 3:59 am

Re: PHP default time zone

Post by implications »

Right, okay. Thanks! And oops, the now() thing is a mysql function, sorry. I'm new to this PHP/MySQL thing so I keep mixing functions up.

I also seem to have double posted this thread for some reason (sorry again).
Post Reply