Skip to content

Flow documentation · legacy product

LocalToUTC ​

Declaration ​

Function LocalToUTC(const AValue: TDateTime): TDateTime

Example ​

pascal
procedure OnMapEvent(var Value:Variant);
begin
    // if Now is 2017-06-25 14:15:16 (i.e. 2:15 pm local NZ Standard Time) then result is 2017-06-25 02:15:16 (i.e. 2:15 a.m. UTC)
// if Now is 2017-12-25 14:15:16 (i.e. 2:15 pm local NZ Daylight Time) then result is 2017-12-25 01:15:16 (i.e. 1:15 a.m. UTC)
Value := LocalToUTC(Now);
end;

Description ​

Returns the date and time value in UTC (Universal Coordinated Time) that corresponds to the given local date and time (AValue).

UTC/Universal Coordinated Time is the base time and time-zone from which the other time-zones around the world are defined and calculated. For almost all practical purposes, UTC is equivalent to the older term "Greenwich Mean Time (GMT)".

UTC never has "Daylight Time" applied to it, whereas local time-zones can have alternating periods of "Standard Time" and "Daylight (Saving) Time". This function will use the time-zone setting from the Windows operating system on the Flow server, at the time that the function is called. This function is not intended to be used for date calculations away from the current local time, because it will not adjust for any changes in time-zone settings that have occurred during the intervening period.

For example, when New Zealand Standard Time applies (i.e. NZ winter time, more or less) the function will return a UTC time that is 12 hours behind, but when New Zealand Daylight Time applies (i.e. NZ summer time, more or less) the function will return a UTC time that is 13 hours behind.