Hunting internationalization bugs here.
Does mysql has a variable which can be set per session, meaning the each connection will know the timezone of it's client and will act upon that.
If such variable does exists I would expect sql statements such as the following will return diffect values, based on connection session locale.
select date('2010-04-14') + 0;
Thank you, Maxim.
-
The DATE() function in MySQL returns server time unless you specify the timezone.
CONVERT_TZ() is useful. Let the user pick their time zone and store it on the server, then convert the date columns to the user's time.
There is a time_zone system variable that you can set for a session, which defaults to "SYSTEM".
Use
SET @@variableto set the value.For example:
SET @@time_zone = 'GMT';However, the server doesn't automatically set this based on the location or timezone of the client.
0 comments:
Post a Comment