Und im umgedrehten Fall so:
Delphi-Quellcode:
[...]
interface
function TzSpecificLocalTimeToSystemTime(lpTimeZoneInformation: PTimeZoneInformation;
var lpLocalTime, lpUniversalTime: TSystemTime): BOOL; stdcall;
{$EXTERNALSYM TzSpecificLocalTimeToSystemTime}
function LocalDateTimeToUTC(aLocal : TDateTime) : TDateTime;
[...]
implementation
function TzSpecificLocalTimeToSystemTime; external kernel32 name 'TzSpecificLocalTimeToSystemTime';
function LocalDateTimeToUTC(aLocal : TDateTime) : TDateTime;
var
tzi : TIME_ZONE_INFORMATION;
utc : TSystemTime;
localtime : TSystemTime;
begin
DateTimeToSystemTime(aLocal, localtime);
GetTimeZoneInformation(tzi);
TzSpecificLocalTimeToSystemTime(@tzi, localtime, utc);
Result := SystemTimeToDateTime(utc);
end;
[...]