我有以下已知的十六进制值和日期对:
"0c133314002a" = "2017_08_24_12_52_00"
"0d1333140002" = "2017_08_24_13_02_00"
"0d133314000c" = "2017_08_24_13_12_00"
"0d1333141b10" = "2017_08_24_13_21_30"
我无法找到从一个到另一个的方法,
0d1333141b10转换为二进制像这样" 11010001001100110011000101000001101100010000" 但是我没有看到二进制文件成为DateTime的方式。
答案 0 :(得分:-1)
想出来,十六进制被混淆并混淆了。
string StupidDate = "0d1333141b10";
string p1 = "0" + Helpers.ArbitraryToDecimalSystem(StupidDate.Substring(6, 2), 13);
if (p1.Length == 3) { p1 = p1.Substring(1, 2); }
string p2 = "0" + Helpers.ArbitraryToDecimalSystem(StupidDate.Substring(2, 2), 5);
if (p2.Length == 3) { p2 = p2.Substring(1, 2); }
string p3 = "0" + Helpers.ArbitraryToDecimalSystem(StupidDate.Substring(4, 2), 7);
if (p3.Length == 3) { p3 = p3.Substring(1, 2); }
string p4 = "0" + Helpers.ArbitraryToDecimalSystem(StupidDate.Substring(0, 2), 17);
if (p4.Length == 3) { p4 = p4.Substring(1, 2); }
string p5 = "0" + Helpers.ArbitraryToDecimalSystem(StupidDate.Substring(10, 2), 21);
if (p5.Length == 3) { p5 = p5.Substring(1, 2); }
string p6 = "0" + Helpers.ArbitraryToDecimalSystem(StupidDate.Substring(8, 2), 19);
if (p6.Length == 3) { p6 = p6.Substring(1, 2); }
string DateString = "20" + p1 + "_" + p2 + "_" + p3 + "_" + p4 + "_" + p5 + "_" + p6;
ArbitraryToDecimalSystem来自:http://www.pvladov.com/2012/07/arbitrary-to-decimal-numeral-system.html