Цитата:
The getTime() method returns the number of milliseconds since midnight of January 1, 1970 and the specified date.
|
Это есть UNIX timestamp. Соответсвенно:
Код:
function UNIXTimeToDateTime(UnixTime: LongWord): TDateTime;
var
TimeZoneInformation: TTimeZoneInformation;
begin
GetTimeZoneInformation(TimeZoneInformation);
Result := StrToDate('01/01/1970') + (UnixTime/(24*3600)) - ((TimeZoneInformation.Bias + TimeZoneInformation.DaylightBias) / (24 * 60));
end;
function DateTimeToUNIXTime(DelphiTime : TDateTime): LongWord;
var
MyTimeZoneInformation: TTimeZoneInformation;
begin
GetTimeZoneInformation(MyTimeZoneInformation);
Result := round(DelphiTime - StrToDate('01/01/1970') + ((MyTimeZoneInformation.Bias) / (24 * 60))) * (24 * 3600);
end;