Skip to content

UnixToDateTime ​

UnixToDateTime converts a Unix/Linux-style date-and-time value to a TDateTime value.

Unix/Linux date-and-time values are encoded as the number of seconds since midnight at the start of January 1, 1970.

Declaration: function UnixToDateTime(const AValue: Int64; AReturnUTC: Boolean): TDateTime;

A sample of code.

pascal
procedure ScriptEvent(var Value:Variant);
var
  ThisDate : TDateTime;
  UNum : int64;
begin
 //Result is 14-11-2023 22:52:24.000
  UNum := 1700002344;
  ThisDate := UnixToDateTime(UNum);
  LogInfo(FormatDateTime('dd-mm-yyyy hh:nn:ss.zzz', ThisDate));
  LogInfo(FloatToStr(Unum));

end;