C# DateTimeCompact 和 TimeCompact
有人告诉什么是 DateTimeCompact 和 TimeCompact,它是如何计算的? 到目前为止,我知道每个都是 2 字节值,可解释为日期和时间,
这里是一个示例值:
0x40410001 = 01.02.2022 00:00:02
0x493ebf7d = 30.09.2026 23:59:58
Someone tell what is DateTimeCompact and TimeCompact, how its calculated?
So far I know each is 2 Byte value interpretable as Date and Time
Here an Example value:
0x40410001 = 01.02.2022 00:00:02
0x493ebf7d = 30.09.2026 23:59:58
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经发现了,但不知道 DateTimeCompact 和 TimeCompact 是否是用于此目的的特殊类型,并且仅与此规范相关,但它发现很有趣,所以我想分享一些知识:-)
DateTimeCompact 是 2 字节 UShort值,可以用 16 位解释如下:
所以问题中的值:
年份是从 1990 年开始计算的,所以
1990年+32=2022年-> 2022.02.01
TimeCompact:
但是秒计算为2秒
最后:2022.02.01 00:00:02
I´ve found out, but do not know whether the DateTimeCompact and TimeCompact is a special type for this purpose and only is relevant for this one specification but its find of interesting so I want to share some knowledge :-)
DateTimeCompact is 2 Byte UShort value and can be interpreted in 16 Bits as followed:
So the value from the queston:
The year is calculated from 1990 so
Year 1990 + 32 = 2022 -> 2022.02.01
TimeCompact:
But seconds are calculated as 2 seconds
So final: 2022.02.01 00:00:02