Balazs Farkas

Balazs Farkas

  • NA
  • 7
  • 1.5k

DateTime conversion

Sep 13 2011 6:24 AM
Hello Guys,

I've a file which is in some binary format I don't know, but I need to be able to read/write it. It contains data for given dates. I'm able to get the data part (some numbers for each days), but I couldn't figure out the dates.

Example (as it is in the file):

HEX, Decimal, Date Value (what it represents)
-----------------------
[66 5f 7f ff] (102,95,127,255) - (2002.05.30)
[66 5f ff ff] (102,95,255,255) - (2002.05.31)

So I need to know how I get the date values from the numbers.

I think it is written in reverse. I tried to convert it to Int32 and check the differences:

255,127,95,102 = 1717534719
255,255,95,102 = 1717567487

The difference is 32768, so that would make 1 day..., but unfortunately it's not always true (ie. I tested a year end example and it was not the case).

So, I would like to ask your help in figuring this out. How to convert it to DateTime and vice-verse.

Thanks,
Balazs

Answers (6)