开发者

How to convert this value to a valid date?

开发者 https://www.devze.com 2023-03-01 09:46 出处:网络
I catch the value of Firstlogin field from a table (from IBSng Database). i know that it is a Date but i don\'t know how can i conver开发者_如何学编程t it into a valid date .

I catch the value of Firstlogin field from a table (from IBSng Database). i know that it is a Date but i don't know how can i conver开发者_如何学编程t it into a valid date .

The value of the field is : 1304077351

how to convert it to a valid date format ?


That is the unix timestamp for Fri, 29 Apr 2011 11:42:31 GMT.

Edit

According to IBS, it uses postgresql as its backend database. You should be able to convert it using to_timestamp.


I found it ! Thank you Anders

function UnixToDateTime(USec: Longint): TDateTime;
const
  // Sets UnixStartDate to TDateTime of 01/01/1970
  UnixStartDate: TDateTime = 25569.0;
begin
  Result := (USec / 86400) + UnixStartDate;
end;
0

精彩评论

暂无评论...
验证码 换一张
取 消