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;
精彩评论