From: "Rudy Velthuis (TeamB)" Newsgroups: borland.public.delphi.students Subject: Re: Unix Timestamp Date: Sun, 3 Mar 2002 21:10:51 +0100 Message-ID: References: <3c8215d7$1_2@dnews> Organization: Praxis drs. Rudolph Velthuis X-Newsreader: MicroPlanet Gravity v2.60 NNTP-Posting-Host: 217.85.250.116 X-Trace: dnews 1015186080 217.85.250.116 (3 Mar 2002 12:08:00 -0800) Lines: 39 X-Authenticated-User: rvelthuis Path: dnews Xref: dnews borland.public.delphi.students:16299 In article <3c8215d7$1_2@dnews>, Rim Ranshuijsen says... > > Hi there, > > I would like to change a Unix TimeStamp into a Delphi TDateTime... Is > that possible, already checked th DatTime Functions in Delphi Help but > can't seem to find it... If you have D6, look at the DateUtils functions: function DateTimeToUnix(const AValue: TDateTime): Int64; function UnixToDateTime(const AValue: Int64): TDateTime; You can do them yourself. Unix time is seconds since Jan 1, 1970. Compile a little test function: function Jan_1_1970: TDateTime; begin Result := EncodeDate(1970, 1, 1); end; It seems that Jan_1_1970 returns 25569.0, so: function UnixToDateTime(Unix: Int64): TDateTime; begin Result := 25569.0 + Unix / SecsPerDay; end; And vice versa: function DateTimeToUnix(DT: TDateTime): Int64; begin Result := Trunc(SecsPerDay * (DT - 25569.0)); end; Groeten uit Duitsland -- Rudy Velthuis (TeamB)