CONVERT_TZ
You are viewing an old version of this article. View
the current version here.
Syntax
CONVERT_TZ(dt,from_tz,to_tz)
Description
CONVERT_TZ() converts a datetime value dt from the time zone given by from_tz to the time zone given by to_tz and returns the resulting value.
In order to use named time zones, such as GMT, MET or Africa/Johannesburg, the time_zone tables must be loaded (see mysql_tzinfo_to_sql).
This function returns NULL if the arguments are invalid (or named time zones have not been loaded).
See time zones for more information.
Examples
SELECT CONVERT_TZ('2016-01-01 12:00:00','GMT','Africa/Johannesburg'); +---------------------------------------------------------------+ | CONVERT_TZ('2016-01-01 12:00:00','GMT','Africa/Johannesburg') | +---------------------------------------------------------------+ | 2016-01-01 14:00:00 | +---------------------------------------------------------------+ SELECT CONVERT_TZ('2016-01-01 12:00:00','+00:00','+10:00'); +-----------------------------------------------------+ | CONVERT_TZ('2016-01-01 12:00:00','+00:00','+10:00') | +-----------------------------------------------------+ | 2016-01-01 22:00:00 | +-----------------------------------------------------+
Comments
Comments loading...
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.