Mysql: Convert DB from local time to UTC
Posted
by Joernsn
on Stack Overflow
See other posts from Stack Overflow
or by Joernsn
Published on 2010-04-22T09:01:22Z
Indexed on
2010/04/22
9:03 UTC
Read the original article
Hit count: 329
I need to convert an existing (datetime fields) db from local time ut UTC.
The values are stored ad datetimes on a server with time zone CET (+1) (with summertime +2). When selecting data I use UNIX_TIMESTAMP()
, which magically compensates for everything, ie, time zone shift and dst (if i've read the docs right).
I'm moving the db to a new server with UTC as system time.
Simply subtracting -1 H won't work, as summer time is +2.
Any ideas for a clever way to do this? (using sql or some script lang)
© Stack Overflow or respective owner