dsjoes Posted January 18, 2011 Share Posted January 18, 2011 how do i change the time zone that my sql database uses it is about five hours behind. Quote Link to comment https://forums.phpfreaks.com/topic/224873-change-mysql-timezone/ Share on other sites More sharing options...
mikosiko Posted January 18, 2011 Share Posted January 18, 2011 in your php.ini look for the definition of date.timezone and define it as you need... example: date.timezone = 'America/New_York' alternative you can change it in your scripts: http://php.net/manual/en/function.date-default-timezone-set.php Quote Link to comment https://forums.phpfreaks.com/topic/224873-change-mysql-timezone/#findComment-1161496 Share on other sites More sharing options...
dsjoes Posted January 18, 2011 Author Share Posted January 18, 2011 it is already set at date.timezone = Europe/London Quote Link to comment https://forums.phpfreaks.com/topic/224873-change-mysql-timezone/#findComment-1161504 Share on other sites More sharing options...
mikosiko Posted January 18, 2011 Share Posted January 18, 2011 if it is defined as you show then is not date.timezone = Europe/London != date.timezone = 'Europe/London' and or != date.timezone = "Europe/London" Quote Link to comment https://forums.phpfreaks.com/topic/224873-change-mysql-timezone/#findComment-1161508 Share on other sites More sharing options...
dsjoes Posted January 20, 2011 Author Share Posted January 20, 2011 i have contacted my host and they said I have checked and noticed that your website is showing the server time. It is not possible to overwrite the server time. Hence you need to upload a script in your website so that it shows the desired time zone. I have uploaded a test script at http://example.com/time.php which shows the time according to timezone = Europe/London. so i'm using the below code which i include into pages that i need it for it works when i echo the the date date_default_timezone_set('Europe/London'); but mysql time still shows the server time how do i stop this. i am using the timestamp in mysql to capture the date and time info was inserted Quote Link to comment https://forums.phpfreaks.com/topic/224873-change-mysql-timezone/#findComment-1162493 Share on other sites More sharing options...
PFMaBiSmAd Posted January 20, 2011 Share Posted January 20, 2011 Assuming you are on a shared web server and only have client/connection access to the mysql server, see the Per-connection time zones section at this link - http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html Quote Link to comment https://forums.phpfreaks.com/topic/224873-change-mysql-timezone/#findComment-1162497 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.