Given some short integers and the dates they represent, is there any systematic method to determine how they’re stored in this format and decode other dates? The data stored is from another piece of software.
I initially thought that the days were represented by one of the bytes, since the first byte for May 1 minus the first byte for Feb 11 did equal the correct number of days (79 for year 2011). But it can’t be that simple, not only because 8 bits can only store 256 days, but also because dates before 2000 store the year only, with both bytes.
Here’s what I’m working with, but take the column headings with a grain of salt.
DDDDDDDD YYYYYYYY DD-MM-YY
01011010 10001010 1955
10110010 10010001 1960
11000000 10010001 1961
11100011 11000011 1996
01010001 11000110 1997
00001101 11001000 1999
10000000 11001001 10-02-00
11010101 11001010 16-01-01
10101010 11001101 11-01-03
00000101 11010000 05-09-04
10011101 11010101 07-08-08
11010000 11010101 27-09-08
00010000 11010110 30-11-08
00110100 11010110 05-01-09
11111110 11010110 26-07-09
10011101 11010111 01-01-10
10110111 11011000 10-10-10
00110011 11011001 11-02-11
00111010 11011001 18-02-11
10000010 11011001 01-05-11
10000101 11011001 04-05-11
01101100 11100110 19-05-20
I also see that 30-11-08 has the same second byte as 05-01-09, and conversely the two dates in 2010 have different values in the second byte.
EDIT: Thanks to the answers and some research, I see that the epoch is November 17, 1858. This is a standard format called the Modified Julian Day.
It looks like it’s days since some point in the past ~1858 (I haven’t worked out all the leap year magic), but the day of year is only displayed in your existing app for years >= 2000. The byte you marked year is the high order byte while the “day” byte is the low order byte.