"For developers", "Server scripts", "Functions description", "Date and time", "LocalTimeToUTC0".

 

Converting local time value to UTC with Windows settings of local GMT shifting; rules for transition to summertime.

 

Syntax

function LocalTimeToUTC(dt: double): double;

 

Parameters and return values

Parameter

Type

Value

dt

double

local computer date/time value from which you need to get UTC value.

 

Function result

Date/time value.

 

Example

var
  dt: double;
begin
  dt := Now;
  
  mLogScript(' Local current time: ' + FormatDateTime('hh:nn:ss', dt), '');
  mLogScript('Current time in UTC: ' + FormatDateTime('hh:nn:ss', LocalTimeToUTC(dt)), '');
end.

Script work result

[16:30:51] (Log "LocalTimeToUTC"):  Local current time: 16:30:51

[16:30:51] (Log "LocalTimeToUTC"): Current time in UTC: 14:30:51

 

See also

FormatDateTime

mLogScript

Now