Home Search

DriveWorks Solo 24
ConvertToUtc

Send Feedback

ConvertToUtc

Converts the provided DateTime to UTC using the provided Time Zone Identifier.

Syntax

ConvertToUtc(Date, Time Zone ID, [Assume Adjusted Time])

Where:

Date is the date to convert.

Time Zone ID is the time zone identifier to convert the DateTime to.

This is the IANA Zone ID of the time zone (see Noda Time | Time Zones).

Assume Adjusted Time (optional) If true, will assume entered time is adjusted; If false (default if not set), will assume standard time.

Assume Adjusted Time is used to handle ambiguous times, for example daylight saving time which occur twice a year (the first occurrence to introduce summer time, the second to revert to standard time).

By default (or FALSE) DriveWorks will assume that the time is given after the time has reverted (the second occurrence), set to TRUE to specify that the time is actually the adjusted (summer time) time before the clocks go back (ie. one hour earlier, standard time).

Examples

Example 1

ConvertToUtc(Now(),"America/Chicago")

Will result in 09/25/2026 14:30:00 (UTC) when called on September 25 2026 at 09:30 (UTC -5 during daylight saving)

Example 2

To obtain the Time Zone ID from a selected row of time zones in a Data Table control.

ConvertToUtc(Now(),TableGetValue(GetTimeZones(),1,TimeZoneTableReturn))

Will result in 09/25/2026 04:30:00 (UTC) when called on September 25 2026 at 09:30 (UTC -5)

Example 2 Data Table

Example data from the GetTimeZones() function, and presented in a Data Table control named TimeZoneTable.

The selected row from the TimeZoneTable control results in the value America/Chicago (column 1) being returned to the TableGetValue function.

IDDisplay NameOffset
America/CancunEastern Standard Time (Mexico)-05:00
America/ChicagoCentral Standard Time-05:00
America/Indiana/KnoxCentral Standard Time-05:00
America/WinnipegCentral Standard Time-05:00
Canada/CentralCentral Standard Time-05:00
US/CentralCentral Standard Time-05:00

See Also

ConvertFromUtc

GetTimeZones