How to format a Unix timestamp in Delphi?

前端 未结 3 1231
[愿得一人]
[愿得一人] 2021-02-04 07:36

I have

var timestamp: Longint;  
timestamp := Round((Now() - 25569.0 {Unix start date in Delphi terms} ) * 86400);

which I am using as a prima

3条回答
  •  情话喂你
    2021-02-04 08:03

    You are looking for

    function DateTimeToUnix(const AValue: TDateTime): Int64;
    

    and

    function UnixToDateTime(const AValue: Int64): TDateTime;
    

    functions from DateUtils.pas

    TDateTime value can be formatted by FormatDateTime function

提交回复
热议问题