unemployment Posted January 26, 2011 Share Posted January 26, 2011 I'm using date_default_timezone_set("America/New_York"); to set the time, but the time isn't being displayed properly in mysql. The time is some other time zone. Do I have to set the time in mysql too? How do I do this? Quote Link to comment https://forums.phpfreaks.com/topic/225773-timestamp-is-wrong/ Share on other sites More sharing options...
Fergal Andrews Posted January 26, 2011 Share Posted January 26, 2011 Hi unemployment, As far as I am aware MySQL uses the system time. "date_default_timezone_set" sets the timezone for PHP's date functions but will not alter the system time, so it will not affect MySQL. Fergal Quote Link to comment https://forums.phpfreaks.com/topic/225773-timestamp-is-wrong/#findComment-1165620 Share on other sites More sharing options...
Pikachu2000 Posted January 26, 2011 Share Posted January 26, 2011 MySQL Timezone Suport Quote Link to comment https://forums.phpfreaks.com/topic/225773-timestamp-is-wrong/#findComment-1165621 Share on other sites More sharing options...
unemployment Posted January 26, 2011 Author Share Posted January 26, 2011 Hi unemployment, As far as I am aware MySQL uses the system time. "date_default_timezone_set" sets the timezone for PHP's date functions but will not alter the system time, so it will not affect MySQL. Fergal I just changed my system time, but mysql still isn't logging the new time. Do I need to restart the server or something? Quote Link to comment https://forums.phpfreaks.com/topic/225773-timestamp-is-wrong/#findComment-1165627 Share on other sites More sharing options...
Fergal Andrews Posted January 26, 2011 Share Posted January 26, 2011 hi unemployment, you shouldn't need to restart the system, but you probably need to restart MySQL so that it takes the updated system time. Fergal Quote Link to comment https://forums.phpfreaks.com/topic/225773-timestamp-is-wrong/#findComment-1165633 Share on other sites More sharing options...
unemployment Posted January 26, 2011 Author Share Posted January 26, 2011 hi unemployment, you shouldn't need to restart the system, but you probably need to restart MySQL so that it takes the updated system time. Fergal That actually fixed it! Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/225773-timestamp-is-wrong/#findComment-1165650 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.