我正在尝试从十六进制序列中提取时间戳数据,并且我缩小了隐藏时间戳的十六进制数据
我发现两个日期大约两分钟
(2012-12-01 06:00:55 -0700)
A4 01 1B FE 36 05 88 23 E4 40
(2012-12-01 06:02:56 -0700)
A4 01 EF F9 AF 10 88 23 E4 40
(2012-12-01 06:00:49 -0700)
A4 01 67 5B A5 04 88 23 E4 40
(2012-12-02 06:00:47 -0700)
A4 01 D6 CF 74 04 A8 23 E4 40
更多时间戳
A4 01 90 A1 B2 03 C8 2E E4 40
A4 01 22 2D E3 03 C8 2E E4 40
-0800
E0 01 FF 15 82 03 C8 2E E4 40
我很确定,基于其他一些我能够取消日期资格的数据,它使用的是小端编码
但这就是我能得到的。我正在使用此网站http://fmdiff.com/fm/timestamp.html将知道时间戳转换为一些常见格式,但我只是没有看到它。
我可以尝试使用此信息的其他格式(可能在.net中)吗?
解决了,谢谢@Markus
这是转换(LE)十六进制
的代码#include <Debug.au3>
#include <Date.au3>
_DebugSetup("Debug")
Func GetExcelTimestamp($dec)
$excel_time = Dec($dec,3)
$timeinms = ($excel_time-25569)*24*3600*1000
$sTime = _DateAdd("s", Int($timeinms / 1000), "1970/01/01 00:00:00")
_DebugOut($dec & " - " & $sTime)
Return $sTime
EndFunc ;==>GetExcelTimeDate
GetExcelTimestamp("40E423880536FE1B")
GetExcelTimestamp("40E4238810AFF9EF")
GetExcelTimestamp("40E4238804A55B67")
GetExcelTimestamp("40E423A80474CFD6")
答案 0 :(得分:3)
这是将读取日期的Java代码(解释如下):
//-------------------------------------------------------------------------------
// Convert from hex to usable date value
long temp = 0x40E423880536FE1BL; // Decode 64-bit little endian (backwards) hex
//long temp = 0x40E4238810AFF9EFL; // example 2
//long temp = 0x40E4238804A55B67L; // example 3
//long temp = 0x40E423A80474CFD6L; // example 4
double excel_time = Double.longBitsToDouble(temp); // days since 1/1/1900
//-------------------------------------------------------------------------------
// Convert to something that Java can handle and output in correct timezone
long java_time = (long) ((excel_time-25569)*24*3600*1000); // ms since 1/1/1970
Date date = new Date(java_time);
SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT")); // don't change timezone
System.out.println(dateFormatGmt.format(date));
日期存储为自1900年1月1日以来的天数(the way Excel stores them),正如您猜测的那样,以小端格式从Double precision floating point转换为十六进制。您在开头包含的A4 01
可能不是日期的一部分。
您的日期存储在您发布的时区(GMT-7)中,而不是UTC中。
注意:强>
如果它是某种其他浮点格式(如80位扩展格式),则A4 01
可能是的一部分。但鉴于你的4个例子中它们是相同的,我宁愿认为它不是。