tags:

views:

1265

answers:

7

3/10/2008 = 1822556159

2/10/2008 = 1822523391

1/10/2008 = 1822490623

30/09/2008 = 1822392319

29/09/2008 = 1822359551

This is all the information that I know at the current time.

Dates increment by 32768 except when changing month when the increment is 32768 x 2 (65536).

Has anyone seen this binary date format and how can I extract the correct date?


It is possible that the remaining portion of the date is for time (hours, minutes, seconds)

+8  A: 

September 30th 2008

1822392319 = 0x6c9f7fff
0x6c = 108 = 2008 (based on 1900 start date)
0x9 = 9 = September
0xf7fff - take top 5 bits = 0x1e = 30

October 1st 2008

1822490623 = 0x6ca0ffff
0x6c = 108 = 2008
0xa = 10  = October
0x0ffff  - take top 5 bits = 0x01 = 1

It's anyone's guess what the remaining 15 one-bits are for, if anything.

EDIT: by take top 5 bits I mean:

day_of_month = (value >> 15) & 0x1f

Similarly:

year = (value >> 24) & 0xff + 1900
month = (value >> 20) & 0x0f
Alnitak
0x0ffff - take top 5 bits = 0x01 = 1Alnitak ... what do you mean by the above statement? Can you expand?
He means that the most significant 5 bits of 0x0ffff are 00001. So of the last 20 bits of the value, the format is using 5 for the day and the remaining 15 are set to 1 in all the examples given.
Steve Jessop
+2  A: 

write it down in a binary format:

a = 1822556159
1101100 1010 00011 111111111111111
b = 1822523391
1101100 1010 00010 111111111111111
c = 1822490623
1101100 1010 00001 111111111111111
d = 1822392319    
1101100 1001 11110 111111111111111

where 1101100 is 108, as Alnitak said, the rest is month (1010 or 1001) and days.

the 1s at the end may be reserved for representing seconds/milliseconds.

mana
A: 

32768 is 2^15; they're reserving 15 bits for the days, which I don't think divides evenly into any useful combination of hours, minutes, and/or seconds.

Adam Jaskiewicz
If memory serves, the date format on FAT filesystems used 15 bits for the time of day, which meant that it can only hold the time to the nearest 2.5 seconds...
pdc
A: 

^ - Moved to Question

+2  A: 

EDIT: Alnitak is correct about this being a fixed-point binary date representation. However, the principles may be similar to what is described below; instead of a decimal place the format is fixed and the lower 15-bits are most likely the time. If you have any examples, post them and we will try to help.

ORIGINAL: This is most likely the Windows OLE/COM date format which uses a Double to represent a date and time. The integer portion of the number is for the date and the fraction is for the time. It can represent dates between January 1, 100, and December 31, 9999. You can find more information at MSDN or google for OLE date COM double.

EDIT: Here is one C# example using DateTime.FromOADate. Here is a little more detail from MSDN VariantTimeToSystemTime.

A variant time is stored as an 8-byte real value (double), representing a date between January 1, 1753 and December 31, 2078, inclusive.

The value 2.0 represents January 1, 1900; 3.0 represents January 2, 1900, and so on.

Adding 1 to the value increments the date by a day. The fractional part of the value represents the time of day. Therefore, 2.5 represents noon on January 1, 1900; 3.25 represents 6:00 A.M. on January 2, 1900, and so on.

Negative numbers represent the dates prior to December 30, 1899.

This is a little conflicting as the COleDateTime documentation says it supports January 1, 100, while this documentation says it supports January 1, 1753.

There are interfaces for VB (use CDbl() and CDate()), C# (DateTime.FromOADate/ToOADate), Java (OLEDate - looks deprecated though), Delphi, Python, etc.

Ryan
this is clearly a fixed-format binary format, and not a floating-point representation
Alnitak
A: 


0x0ffff - take top 5 bits = 0x01 = 1

Alnitak ... what do you mean by the above statement?

Ryan ... Can you provide a direct link to the OLE/COM date format which you describe?

this should be a comment not a new question
Paul Whelan
will note this for future, thanks. just learning the stackoverflow UI at the moment.
A: 

Here is another 'mysterious' format I found with a WinMobile Backup App (http://www.dotfred.net/default.htm): Reading the Appointments I get strings like this (date values are set on the PPC device): 0xab,0xaa,0xaa,0xaa,0x82,0xae,0xe3,0x40 (10.Mai 2010) 0xab,0xaa,0xaa,0xaa,0xa2,0xae,0xe3,0x40 (11.Mai 2010) 0x55,0x55,0x55,0x55,0x55,0x55,0x00,0x40 (01.Jan 1900) 0x55,0x55,0x55,0x55,0x55,0x55,0x08,0x40 (02.Jan 1900)

All this is based -- I expect -- on the MS http://msdn.microsoft.com/en-us/library/aa908499%28v=MSDN.10%29.aspx .. but the above seems not to fit to that model.

Any help/suggestion? Thanks Günter

neandr