Seen this binary date format?

前端 未结 4 1221
既然无缘
既然无缘 2020-12-18 11:29

3/10/2008 = 1822556159

2/10/2008 = 1822523391

1/10/2008 = 1822490623

30/09/2008 = 1822392319

29/09/2008 = 1822359551

This is all the

4条回答
  •  孤城傲影
    2020-12-18 12:02

    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
    

提交回复
热议问题