TZCONVERT

Purpose:

Converts date time values to a target time zone.

Syntax:

TZCONVERT(date, time, "targzone", "srczone")

date

-

Optional. A string or series of dates, the local date. Defaults to the current date.

time

-

Optional. A string or series of times, the local time. Defaults to the current time.

"targzone"

-

Optional. A string, the target time zone. Defaults to the current time zone.

"srczone"

-

Optional. A string, the source time zone. Defaults to the current time zone.

Returns:

A string or series, the date and time of the input values in the target time zone.

Example:

tzconvert()

 

Returns the current date and time.

Example:

tzconvert("America/Los_Angeles")

 

Returns the current date and time in the US Pacific time zone.

Example:

tzconvert("1/1/2024", "12:00:00", "UTC", "America/New_York")

 

Returns "1/01/2024 17:00:00", the corresponding UTC date time of noon on January 1, 2024 in the US Eastern time zone.

Example:

local2utc("1/1/2024", "12:00:00", "America/New_York")

 

Same as above.

Example:

tzconvert("1/1-2024", "12:00:00", "UTC", "America/Los_Angeles")

 

Returns "1/01-2024 20:00:00", the corresponding UTC date time of noon on January 1, 2024 in the US Pacific time zone.

 

Example:

tzconvert("1/1-2024", "12:00:00", "America/Los_Angeles", "America/New_York")

 

Returns "1/01-2024 9:00:00", the corresponding date time in the US Pacific time zone of noon, January 1, 2024 in the Eastern time zone.

Example:

dt =  {{julstr("2024/11/03"), todstr("22:30:00")},

       {julstr("2024/11/03"), todstr("23:30:00")}};

 

W1: dt;setvunits(w0, "date", 1, 1);setvunits(w0, "time", 1, 2)

W2: tzconvert(W1, "America/New_York", "America/Chicago")

 

W2 contains the date time:

 

11/03/2024  23:30:00

11/04/2024  00:30:00

 

W2 converts the date times of W1 in the US Central time zone to date time values in the Eastern time zone.

Example:

W1: {{ymdhms2dt(2024, 11, 3, 22, 30, 0)},

     {ymdhms2dt(2024, 11, 2, 23, 30, 0)}};

 

W2: tzconvert(W1, "America/New_York", "America/Chicago")

 

Same as above, except the date time values are created by YMDHMS2DT.

 

W2 contains the date time:

 

11/03/2024  23:30:00

11/04/2024  00:30:00

Remarks:

UTC stands for Coordinated Universal Time and is a reference time for all time zones worldwide. UTC is historically linked to Greenwich Mean Time (GMT), but is more precise.

 

TZCONVERT converts date and times to date and time values within a specified time.

 

The targzone and srczone strings are case sensitive should adhere to the IANA timezone identifiers available at:

 

https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

and:

https://www.iana.org/time-zones

 

If targzone is blank or "local", the local time zone is used.

 

If srczone is blank or "local" or unspecified, the local time zone is used.

 

See LOCAL2UTC and UTC2LOCAL to convert to and from UTC date time values.

See Also:

CLOCK

GETDATE

GETDT

GETTIME

LOCAL2UTC

UTC2LOCAL

YMDHMS2DT