F16 FileTime und FileDate in Delphi richtig anzeigen

pvs-deck
PowerUser
Avatar
Gender:
Age: 53
Homepage: pvs-deck.de
Posts: 1340
Registered: 02 / 2009
Subject:

F16 FileTime und FileDate in Delphi richtig anzeigen

 · 
Posted: 06.01.2020 - 20:17  ·  #1
Hallo rolf,

ich bekomme ja beim "F16_FindNext()" einen Verzeichniseintrag und im Record unter
SR.Dir.WrAccTime und SR.Dir.WrAccDate. Beides sind vom Datentyp WORD.

Wie ist das Datum / Zeit in dem Word gespeichert?

Bei der Uhrzeit könnte ich mir bei einem WORD eine BCD vorstellen
Code
BITs:
<15 14 13 12>  2  // h 10er
<11 10 09 08>  0  // h 1er
<07 06 05 04>  2  // m 10er
<03 02 01 00>  0  // m 1er


Aber wie ist das beim Datum aufgebaut?

Ich muss für den Filetransfer über USB das Datum und Uhrzeit in beide Richtungen erhalten, also muss ich das auf beiden Systemem erstellen können. Als String möchte ich das nur sehr ungerne machen.

Thorsten
rage
Benutzer
Avatar
Gender: n/a
Age: 64
Homepage: processanalytik.de
Posts: 235
Registered: 02 / 2007
Subject:

Re: F16 FileTime und FileDate in Delphi richtig anzeigen

 · 
Posted: 07.01.2020 - 08:56  ·  #2
Guten Morgen,

Code

wFatDate
The MS-DOS date. The date is a packed value with the following format.
Bits   Description
0-4   Day of the month (1–31)
5-8   Month (1 = January, 2 = February, and so on)
9-15   Year offset from 1980 (add 1980 to get actual year)

wFatTime
The MS-DOS time. The time is a packed value with the following format.
Bits   Description
0-4   Second divided by 2
5-10   Minute (0–59)
11-15   Hour (0–23 on a 24-hour clock)

Quelle:
Dekodieren kann man das bequem mit Delphi.
Code

  var FileDate  : Integer;
        FDate     : TDateTime;
......
  LongRec(FileDate).Lo:=  Time;//(CMD.Data[0]*256)+CMD.Data[1];
  LongRec(FileDate).Hi:=  Date;//(CMD.Data[2]*256)+CMD.Data[3];
  Try
    FDate:=SysUtils.FileDateToDateTime(FileDate);
  except
    FDAte:=0;
  end;

LG Ralf
pvs-deck
PowerUser
Avatar
Gender:
Age: 53
Homepage: pvs-deck.de
Posts: 1340
Registered: 02 / 2009
Subject:

Re: F16 FileTime und FileDate in Delphi richtig anzeigen

 · 
Posted: 07.01.2020 - 10:30  ·  #3
Quote by rage

Guten Morgen,

Code

wFatDate
The MS-DOS date. The date is a packed value with the following format.
Bits   Description
0-4   Day of the month (1–31)
5-8   Month (1 = January, 2 = February, and so on)
9-15   Year offset from 1980 (add 1980 to get actual year)

wFatTime
The MS-DOS time. The time is a packed value with the following format.
Bits   Description
0-4   Second divided by 2
5-10   Minute (0–59)
11-15   Hour (0–23 on a 24-hour clock)

Quelle:
Dekodieren kann man das bequem mit Delphi.
Code

  var FileDate  : Integer;
        FDate     : TDateTime;
......
  LongRec(FileDate).Lo:=  Time;//(CMD.Data[0]*256)+CMD.Data[1];
  LongRec(FileDate).Hi:=  Date;//(CMD.Data[2]*256)+CMD.Data[3];
  Try
    FDate:=SysUtils.FileDateToDateTime(FileDate);
  except
    FDAte:=0;
  end;

LG Ralf


Hallo Ralf,

klasse, das setzte ich später gleich mal um.

Danke

Thorsten
pvs-deck
PowerUser
Avatar
Gender:
Age: 53
Homepage: pvs-deck.de
Posts: 1340
Registered: 02 / 2009
Subject:

Re: F16 FileTime und FileDate in Delphi richtig anzeigen

 · 
Posted: 07.01.2020 - 22:44  ·  #4
Hallo Ralf,

hat funktioniert :-)

Thorsten
You must be logged in or your permissions are to low to see this Attachment(s).
rage
Benutzer
Avatar
Gender: n/a
Age: 64
Homepage: processanalytik.de
Posts: 235
Registered: 02 / 2007
Subject:

Re: F16 FileTime und FileDate in Delphi richtig anzeigen

 · 
Posted: 08.01.2020 - 10:45  ·  #5
Hey Thorsten,

freut mich.

LG Ralf
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   96   110 · Page-Gen-Time: 0.023361s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI