如何将一些数字解码为 timeDate?
这个问题是这个问题的续集。
那么知道如何将这个数字 5252235562500 解码为日期和时间 19.11.2010 15:43 吗? 我有更多这样的对,我正在考虑一些脚本来比较它们以找到一些模式。有什么建议可以检查什么以及如何搜索模式吗?
编辑:我添加了我目前拥有的四对。
- 2010年11月11日 16:23 > 5252425372575
- 2010年11月16日 15:30 > 5252922462564
- 2010年11月19日 15:39 > 5252231562511
- 2010年11月19日 15:43 > 5252235562500
This question is sequel of this one.
So any idea how to decode this number 5252235562500 into date and time 19.11.2010 15:43 ?
I have more pairs like this and I'm thinking about some script for comparing them to find some patern. Any advice what to check and how to search for patterns ?
EDIT: I added four pairs that I curentlly have.
- 11.11.2010 16:23 > 5252425372575
- 16.11.2010 15:30 > 5252922462564
- 19.11.2010 15:39 > 5252231562511
- 19.11.2010 15:43 > 5252235562500
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想我找到了解决方案。我不想简单地展示解码算法,而是想向您展示推理过程。
链接问题的答案显示这是 EAN-13 格式。
这意味着代码有 12 位和 1 个校验位:
校验位可以通过将
我计算了每个代码的校验位,它匹配并确认代码采用 EAN-13 格式。
根据规范,代码的前两位或三位数字可能是国家/地区代码,因此我尝试将它们分开:
结果数字没有任何意义,因为较早的时间有更大的数字:
5292246256或292246256
比晚一点的时间:
5223156251 或 223156251
此时我怀疑时间不是以二进制格式存储的。
我重新组织了数字并试图找到重复的模式。
我最终得到了这个布局:
这就是事情变得有趣的地方...
看一下第三行和第四行,除了第四列和第六列之外,这些都是相同的。
第 4 列有 15 和 55。将其向后翻译,您将得到 51 和 55。
两者之差为55 - 51 = 4,就像分钟之差43 - 39 = 4
从代码值中减去分钟:
55 - 43 = 12
51 - 39 = 12
看来第四列通过添加 12 并向后存储数字来对分钟进行编码。
现在尝试将此应用于第 5 列:
26 - 15 = 11 和 27 - 16 = 11,因此第 5 列的差异为 11。
从那时起就很容易了,列的差异是 15、14、13、12 和 15、14、13、12 和 16。 11.
一些快速计算,您就可以得到编码方案:
这是一个用于解码的简单代码片段:
I think I found the solution. Instead of simply presenting the decoding algorithm I'd like to show you the reasoning.
The answer to the linked question showed that was a barcode in EAN-13 format.
It means the codes have 12 digits and 1 check digit:
The check digit can be calculated by
I calculated the check digit for every code, it matched and confirmed the codes were in EAN-13 format.
According to the specification, the first two or three digits of the code could be country codes, so I tried to separate these:
The resulting numbers didn't make any sense, because the earlier time had a greater number:
5292246256 or 292246256
than the later time:
5223156251 or 223156251
At this point I suspected the time wasn't stored in binary format.
I reorganized the digits and tried to find repeating patterns.
I ended up with this layout:
This is where things got interesting...
Take a look at the 3rd and 4th row, these are the same except the 4th and 6th column.
The 4th column has 15 and 55. Translate it backwards and you get 51 and 55.
The difference of the two is 55 - 51 = 4 just like the difference of minutes 43 - 39 = 4
Subtract the minutes from code values:
55 - 43 = 12
51 - 39 = 12
It seems the 4th column encodes minutes by adding 12 and storing the digits backwards.
Now try to apply this to the 5th column:
26 - 15 = 11 and 27 - 16 = 11 so the difference for the 5th column is 11.
From then it's easy, the differences for the columns are 15, 14, 13, 12 & 11.
A few quick calculations and you get the encoding scheme:
Here's a simple code snippet for decoding:
当您尝试解码外国时间格式时,您需要两个已知时间。看看它们之间的差异,看看它相当于什么——秒、毫秒、天,没有太多的可能性。现在您已经有了基本时间单位,您可以使用其中一个时间来查看原始时间是什么。
我上周才不得不这样做。我有两个日期:
有很多方法可以获取两个日期之间的差异。最简单的可能是 Excel,它会显示天数的差异;在本例中为 1.70744213。两种表示形式之间的差异是147523。将天数乘以一天中的秒数(24*60*60)也得到147523,所以现在我知道日期是从某个开始经过的秒数日期。
为了获得开始日期,我从日期本身减去一个日期。这在 Excel 中也是微不足道的:将日期数字除以一天中的秒数,然后减去。就我而言,它出现在 1969-12-31 19:00。这看起来有点奇怪,但我意识到我的时区在夏天与 UTC 相差 5 个小时。这告诉我时间值采用 UTC 格式,表示自 1970-01-01 以来的秒数。
When you're trying to decode a foreign time format, you need two known times. Take the difference between them and see what it equates to - second, milliseconds, days, there aren't too many possibilities. Now that you have the basic time unit, you can work with one of the times and see what the origin time is.
I just had to do this last week. I had two dates:
There are lots of ways to get the difference between two dates. The easiest is probably Excel, which will display the difference in days; in this case 1.70744213. The difference between the two representations is 147523. Multiplying the number of days by the number of seconds in a day (24*60*60) also resulted in 147523, so now I know that the date is the number of seconds elapsed from some starting date.
To get the starting date, I subtract a date from itself. Again this is trivial in Excel: divide the date number by the number of seconds in a day, then subtract. In my case it comes up 1969-12-31 19:00. This seems a little odd, but I realize that my time zone is 5 hours off of UTC in the summer. This tells me that the time value is in UTC, and represents the number of seconds since 1970-01-01.
像这样的脚本你所想的没有任何意义,因为你可以手动在
X
时间内制动它,那么你可能会在25*X
25*X< /code> 并且该程序将基于检查您定义的模式来工作,那么当您没有数千种这种类型的算法来制动但在某些小部分有所不同时,这是没有意义的。
多给一些,我就可以告诉你更多,一对就意味着什么都不知道。
Script like this what you are thinking not make any sense, because you can by hand for example brake this in time
X
, then probably you will be write program for this in time25*X
and this program will be working based on checking patterns what you are define then this not make sense when you don't have thousands of algorithms this type to brake but vary in some little part.Give some more pairs then i can tell you more, one pair is to less to know anything.