Показать сообщение отдельно
  #2  
Старый 27.07.2010, 22:14
lmikle lmikle вне форума
Модератор
 
Регистрация: 17.04.2008
Сообщения: 8,015
Версия Delphi: 7, XE3, 10.2
Репутация: 49089
По умолчанию

Цитата:
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;
Ответить с цитированием