DateTimeZone.From

About

Returns a datetimezone value from a value.

Syntax

DateTimeZone.From(value as any, optional culture as nullable text) as nullable datetimezone  

Arguments

Argument Description
value Value to convert.
optional culture A text value corresponding to the culture values supported on your version of Windows, such as "en-US". If the culture is not specified, the current user culture is used. For a list of culture names, see National Language Support (NLS) API Reference.

Type to convert

Type Description
text Returns a datetimezone value from a text value. For more details, see DateTimeZone.FromText.
date A datetimezone with value as the date component, 12:0:00 AM as the time component and the offset corresponding the local time zone.
datetime A datetimezone with value as the datetime and the offset corresponding the local time zone.
time A datetimezone with the date equivalent of the OLE Automation Date of 0 as the date component, value as the time component and the offset corresponding the local time zone.
number A datetimezone with the datetime equivalent the OLE Automation Date expressed by value and the offset corresponding the local time zone.
any other type An Expression.Error is thrown.

Remarks

  • If a value is null, DateTimeZone.From returns null.

  • If a value is datetimezone , the same value is returned.

Example

DateTimeZone.From("2020-10-30T01:30:00-08:00") equals #datetimezone(2020, 10, 30, 01, 30, 00, -8, 00)