MySQL NOW function Minus Four hours (bad server time)
Moderator: General Moderators
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
MySQL NOW function Minus Four hours (bad server time)
My current host (the genius that he is) has the server set four hours ahead of us. I currently use the NOW() function to create a time stamp though it there a reasonably way to adjust the hours so I'm looking at the time from my own time zone? Suggestions for using something other then the now function are welcomed too.
Re: MySQL NOW function Minus Four hours (bad server time)
i'm using oxyhost for my website.. we have the same problem actually.. but the solution that they have provided is in the .HTaccess... if you know how to code on .htaccess, you can set your own time zone there... IF your host allows you
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: MySQL NOW function Minus Four hours (bad server time)
I added this however I don't think it had much if any effect?
Code: Select all
SetEnv TZ America/New_YorkRe: MySQL NOW function Minus Four hours (bad server time)
well .htaccess can be modified but only works if the host allows it so.. to make things sure you can write email to the host like you know i think they have forums where you can post questions and also ask them how to place the .htaccess code for timezone
Re: MySQL NOW function Minus Four hours (bad server time)
.htaccess won't change the value MySQL gets with it's NOW() function will it?
Use "SET time_zone = '+4:00';". You'll need to do it every time you connect to mysql, so your database connection file will likely look something like:
If that doesn't work, try DATE_ADD(NOW(), INTERVAL 4 HOUR) in place of NOW().
Use "SET time_zone = '+4:00';". You'll need to do it every time you connect to mysql, so your database connection file will likely look something like:
Code: Select all
mysql_connect('localhost', 'username', 'password');
mysql_select_db('mydatabase');
mysql_query("SET time_zone = '+4:00';");- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact: