Hello,

i have a table that contains datetime entries which are stored in GMT. Now I 
would like to convert these datetime values in a select statement to local 
time. I first thought of someting like this (in germany DST starts at 
2004-03-29�02:00:00  and ends�"2004-10-31�03:00:00" this year. The difference 
from GMT to local time is 1h and from GMT to local DST time 2h):

SELECT��
��if(datetime�between�"2004-03-29�02:00:00"�AND�"2004-10-31�03:00:00",
��������DATE_ADD(datetime,�INTERVAl�2�HOUR),����
��������DATE_ADD(datetime,�INTERVAL�1�HOUR)����������������
�����)�FROM�table�...�
��...

This basically works but of course only if the select statement return rows 
with datetime entries in the year 2004. Eg if there are rows with a datetime 
field of "2003-xx-xx" then the statement from above will fail. 

Is there any more general way to do such a timezone conversion or is the only 
solution to let the application to this work that reads the MYSQL output? 

Thanks
Rainer
-- 
---------------------------------------------------------------------------
Rainer Krienke, Universitaet Koblenz, Rechenzentrum, Raum A022
Universitaetsstrasse 1, 56070 Koblenz, Tel: +49 261287 -1312, Fax: -1001312
Mail: [EMAIL PROTECTED], Web: http://www.uni-koblenz.de/~krienke
Get my public PGP key: http://www.uni-koblenz.de/~krienke/mypgp.html
---------------------------------------------------------------------------

Attachment: pgp00000.pgp
Description: signature

Reply via email to