DaveGetBlockInfo, format von modification date ??

Ruud

Level-1
Beiträge
66
Reaktionspunkte
0
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo zusammen,

Ich will gerne mit hilfe von LibNoDave, die "modification date " aus die funktion GetBlockInfo ubersetzen in das vb format datum.

Die struktur die aus GetBlockInfo komt ist 70 byte lang.
Ab byte 22 begint die "modification date" und ist 6 bytes lang.

byte(22) hat die decimale wert:2
byte(23) hat die decimale wert:190
byte(24) hat die decimale wert:220
byte(25) hat die decimale wert:111
byte(26) hat die decimale wert:38
byte(27) hat die decimale wert:139

Und das alles muste die volgende datum sein: 01/06/2011 12:47:42 PM

Wie musste ich den diese werten ubsertzen nach ein datum format?
 
So hab Ich in meiner Lib.

Ist aber in CSharp!

Der Teile des Code stammt von "Human", wurde von mir bloß von Delphi in CSharp umgesetzt!

Code:
public static DateTime GetDT(byte b1, byte b2, byte b3, byte b4, byte b5, byte b6)
        {
            System.DateTime DT;
            string Result;

            DT = new DateTime(1984, 1, 1, 0, 0, 0, 0);
            DT.AddMilliseconds((b1 * 0x1000000) + (b2 * 0x10000) + (b3 * 0x100) + b4);
            DT.AddDays((b5 * 0x100) + b6);
            Result = DT.Day.ToString() + "." + DT.Month.ToString() + "." + DT.Year.ToString() + " " + DT.Hour.ToString() +
                     ":" + DT.Minute.ToString() + ":" + DT.Second.ToString() + "." + DT.Millisecond.ToString();

            return DT;
        }
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo Jochen,

Danke fur die schnelle und gute antwort!

Fur VB.net seht das so aus:

Dim DT As System.DateTime
DT = New DateTime(1984, 1, 1, 0, 0, 0, 0)
DT = DT.AddMilliseconds(Hex(myDateBuffer(1)) * &H1000000)
DT = DT.AddMilliseconds(myDateBuffer(2) * &H10000)
DT = DT.AddMilliseconds(myDateBuffer(3) * &H100)
DT = DT.AddMilliseconds(myDateBuffer(4))
DT = DT.AddDays(myDateBuffer(5) * &H100)
DT = DT.AddDays(myDateBuffer(6))
Debug.Print(DT.Day.ToString() + "." + DT.Month.ToString() + "." + DT.Year.ToString() + " " + DT.Hour.ToString() & ":" + DT.Minute.ToString() + ":" + DT.Second.ToString() + "." + DT.Millisecond.ToString())
 
`Selbst habe ich keine idee, aber die Jochen Kuhner (meine tastatur kennt keine umlaut ;-) sorry) hat glaube ich eine ganze library in C-sharp geschrieben.
 
Zurück
Oben