CONVERT_TZ()
converts a datetime value dt
from the time zone given by from_tz
to the time zone given byto_tz
and returns the resulting value. Time zones are specified as described in Section 10.6, “MySQL Server Time Zone Support”. This function returns NULL
if the arguments are invalid.
If the value falls out of the supported range of the
TIMESTAMP
type when converted from from_tz
to UTC, no conversion occurs. The TIMESTAMP
range is described in Section 11.1.2, “Date and Time Type Overview”.mysql>SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');
-> '2004-01-01 13:00:00' mysql>SELECT CONVERT_TZ('2004-01-01 12:00:00','+00:00','+10:00');
-> '2004-01-01 22:00:00'
Note
To use named time zones such as
'MET'
or 'Europe/Moscow'
, the time zone tables must be properly set up. See Section 10.6, “MySQL Server Time Zone Support”, for instructions.
No comments:
Post a Comment