Page 1 of 1
PHP default time zone
Posted: Sat Jun 18, 2011 10:25 pm
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.
Re: PHP default time zone
Posted: Sat Jun 18, 2011 10:33 pm
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.
Re: PHP default time zone
Posted: Sat Jun 18, 2011 10:42 pm
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).