Dealing with PHP server and MySQL server in different time zones
问题 For those of us who use standard shared hosting packages, such as GoDaddy or Network Solutions, how do you handle datetime conversions when your hosting server (PHP) and MySQL server are in different time zones? Also, does anybody have some best practice advice for determining what time zone a visitor to your site is in and manipulating a datetime variable appropriately? 回答1: As of PHP 5.1.0 you can use date_default_timezone_set() function to set the default timezone used by all date/time