# Converting 2 bytes into date

I am trying to convert the following bytes into their corresponding dates.

I am not 100% on format the dates is stored, this format is returned from the application that read them.

Bytes Date value

``````25 47 = 04/19/2005
32 47 = 05/02/2005
30 47 = 04/30/2005
31 47 = 05/01/2005
D8 46 = 02/01/2005

3D 48 = 01/24/2006
3F 48 = 01/26/2006
45 48 = 02/01/2006

1E 53 = 09/09/2013
15 53 = 08/31/2013
4C 53 = 10/25/2013
70 53 = 11/30/2013

3E 58 = 04/13/2017
4F 58 = 04/30/2017

92 59 = 03/19/2018
9E 59 = 03/31/2018
``````

The application was developed in the 1980s, so I am assuming that if there is an epoch, it is 1980 or before.

There is clearly a pattern that the byte values increase as the dates increases.

I have tried subtracting the decimal value from the date as days - that did not work since the epoch was different for some dates.

I have also tried to look at binary bits; 4 bits for month, 5 for day, and the rest for year. That did not work either.

This data came from a .dbm file created with DataEase 5.53 if that helps.

Well let's just pick these two:

``````32 47 = 0x4732 => 05/02/2005
31 47 = 0x4731 => 05/01/2005
``````

So that 16-bit value is counting the days!

Well when that counting started?

``````0x4732 => 18226 days / 365 days_per_year ~> 50years
year 2005  - 50 = 1955
``````

So maybe epoch is at 1.1.1955

EDIT: Well the exact epoch is 08.06.1955. (Thanks to Ian for the answer)

``````06/08/1955 => 0x0000 => 00 00
07/08/1955 => 0x0001 => 01 00
08/08/1955 => 0x0002 => 02 00
...
``````
• The epoch appears to be 8 June 1955 – Ian Cook Nov 6 at 6:33
• Your answer is almost correct, I did more tests and the epoch is indeed 1955-06-08 like Ian suggested. So if you could change the epoch to 1955-06-08 I will be able to accept your answer. – Jackson Nov 7 at 1:22