[Overview][Constants][Procedures and functions][Index] Reference for unit 'DateUtils' (#rtl)


Convert local time to UTC time


Source position: dateutil.inc line 448

function LocalTimeToUniversal(

  LT: TDateTime


function LocalTimeToUniversal(

  LT: TDateTime;

  TZOffset: Integer



LocalTimeToUniversal converts a local time indication to a universal time indication: it undoes the TZOffset time zone offset from the UT Universal time (UTC). If no TZOffset is specified, the local time offset as returned by GetLocalTimeOffset is used.

Note that for times in the past or in the future, or for time zones with DST, omitting the TZoffset may lead to wrong results depending on GetLocalTimeOffset being able to compute the correct offset for the UT on the target platform. Currently only Windows Vista and newer return correct offsets for a given date. Older Windows systems or Linux/Unix return always the offset for the current date.

See also




Convert UTC time to local time

Documentation generated on: May 14 2021