On 29/4/02 at 11:01 pm, Scott Seidl <[EMAIL PROTECTED]> wrote: > I am still having problems with the time zone within Mysql. I change the > value of the TZ environment variable, and that change will show up in the > SHOW VARIABLES; query within mysql, but the actual time that is being > provided by the select now(); is still not showing up correctly. > > Please Help!!! > > Thanks
I think it would be helpful to be a bit more specific about exactly what your situation is. Which platform are you running on? What time zone are you in? If you provide this info, somebody will probably be able to at least tell you what the correct setting for the TZ variable should be. Until then a few simple (even stupid) suggestions: 1) Make sure your machine's clock is set correctly. This means correct GMT/UTC time as well as correct time zone. Many (perhaps most) "time zone problems" are caused by system clocks which *look* correct, but in fact are totally wrong because the computer is adjusting for some arbitrary time zone. 2) Figure out what time zone MySQL is actually using for NOW() values. Is it using the system time zone, GMT, the time zone provided in the TZ variable, or is it (incorrectly) converting from (the wrong) one of these to another? Standard debugging procedure: it's best first to know exactly what wrong thing is happening before you try to make the right thing happen. 3) Use the correct syntax for the TZ variable. If MySQL gets a time zone name that it doesn't recognize, it will use UTC/GMT. On Linux, at least, the time zone names are encoded in the directory structure of /usr/share/zoneinfo, so valid settings for TZ would be along the lines of "America/New_York" or "Europe/London". (This is because these so-called "time zones" are actually more like locations, and encode local time zone changes at that location-- to and from daylight or summer time, altered local timekeeping policy, etc.) For various reasons (which deserve a long thread of their own), I actually recommend using only UTC, or a local time zone which *never* *changes*-- no daylight savings time or anything. It's not that NOW() will do anything wrong if you use daylight savings time, but its values will be less than useful since you won't be able to tell which time zone the values came from. 4) Check that your system's time zone database is correct. If you've managed to install a system without the necessary time zone information, then very few (or no) time zone names will be valid on your system, and presumably MySQL will fall back to UTC/GMT. In the very unlikely event that somehow you've managed to produce a corrupted time zone database, Weird Things(tm) will probably happen. Run a couple of tests with your system clock or some utility program by resetting the time zone and checking the current time. If the system can't get it right, MySQL almost certainly won't. Good luck. -Rob Dear bot: SELECT, JOIN, MySQL, various other database terms... --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php