Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

File find: How to decode time in TSearchRec/FindFirst?

1,839 views
Skip to first unread message

Matthew

unread,
May 27, 1997, 3:00:00 AM5/27/97
to

TSearchRec is used to find and identify a particular file, its size
and time stamp. FindFirst places the result in TSearchRec, e.g
MySearchRec.Time.

However, TSearchRec.Time is a longint. That is not a date format.
TDateTime is compatible with the type "extended", not "longint". I
thought the longint might be the value in seconds. However, converting
seconds to date by a divisor of 24*60*60 yields incorrect dates and
times.

Delphi's 16-bit online help offers no clues.

Any ideas?

Email me. I appreciate it and reply to every email.
Matthew

Enzo Arlati

unread,
May 28, 1997, 3:00:00 AM5/28/97
to

I think this could example should give you an answer

var
dt: TDateTime;
sr: TSearchrec;
y, d, m, h, min, sec, msec: word;
begin

......................

dt := fileDateToDateTime(sr.time);
decodeDate( dt, y, d, m );
decodeTime( dt, h, min, sec, msec );
end;

Regards, Enzo

Matthew wrote in article <338b7...@news.power.net.uk>...

Enzo Arlati

unread,
May 28, 1997, 3:00:00 AM5/28/97
to

I think this could example should give you an answer

var
dt: TDateTime;
sr: TSearchrec;
y, d, m, h, min, sec, msec: word;
begin

.....................

dt := fileDateToDateTime(sr.time);


decodeDate( dt, y, d, m );
decodeTime( dt, h, min, sec, msec );
end;

Regards, Enzo
===========

Enzo Arlati , e.ar...@sinergy.it

Sinergy srl via Modigliani 45 Segrate 20090 (MI) Italy

www -> http://arlati.sinergy.it/

===================================

Andrew Gabb

unread,
May 28, 1997, 3:00:00 AM5/28/97
to

Matthew wrote:
.> However, TSearchRec.Time is a longint. That is not a date format.
.> TDateTime is compatible with the type "extended", not "longint". I
.> thought the longint might be the value in seconds. However,
.converting
.> seconds to date by a divisor of 24*60*60 yields incorrect dates and
.> times.
.>
.> Delphi's 16-bit online help offers no clues.

Well, that's not really true, but I have blind spots myself.

Search under filedate...

Andrew

David A. Schweizer

unread,
May 29, 1997, 3:00:00 AM5/29/97
to

On Tue, 27 May 1997 23:48:16 GMT, Com...@lottery.powernet.co.uk
(Matthew) wrote:

>TSearchRec is used to find and identify a particular file, its size
>and time stamp. FindFirst places the result in TSearchRec, e.g
>MySearchRec.Time.
>

>However, TSearchRec.Time is a longint. That is not a date format.

>TDateTime is compatible with the type "extended", not "longint". I

>thought the longint might be the value in seconds. However, converting


>seconds to date by a divisor of 24*60*60 yields incorrect dates and

>times.


>
>Delphi's 16-bit online help offers no clues.
>

>Any ideas?
>
>Email me. I appreciate it and reply to every email.
>Matthew
>

Matthew,

Look at FileDateToDateTime in the SysUtils unit.

hth,
David


David A. Schweizer

iec ProGAMMA, The Netherlands
d.a.sc...@gamma.rug.nl

Paul Motyer

unread,
May 30, 1997, 3:00:00 AM5/30/97
to

to get a TDateTime use FileDateToDateTime(SearchRec.time);

HTH,

--
Paul Motyer
Soft Stuff, Croydon, Australia, 3136


Matthew <Com...@lottery.powernet.co.uk > wrote in article
<338b7...@news.power.net.uk>...

0 new messages