http://www.cnblogs.com/findumars/p/4716753.html
c++builder
// 将Java中的日期转换为Delphi中的日期 TDateTime ConvertJavaDateTimeToDelphiDateTime(__int64 Value) { return IncMilliSecond(StrToDate("1970-1-1"), Value); } // 将Delphi中的日期转换为Java中的日期 double ConvertDelphiDateTimeToJavaDateTime(TDateTime ADateTime) { return MilliSecondSpan(ADateTime, StrToDate("1970-1-1")); }
1483927576698
// pc端接收到的数据00 00 01 59 80 f9 e0 7a // 2017-01-09 02:06:16 byte bta[8] = { 0x7a,0xe0,0xf9,0x80,0x59,0x01,0x00,0x00 }; // byte bta[8] = { 0x00,0x00,0x01,0x59,0x80,0xf9,0xe0,0x7a }; double da = *(__int64*)&bta[0]; TDateTime dtad; dtad = ConvertJavaDateTimeToDelphiDateTime(da);
TDateTime dt1; dt1 = StrToDateTime("2017-01-09 02:06:16"); double jv1; jv1 = ConvertDelphiDateTimeToJavaDateTime(dt1); byte bt1[8]; memcpy(&bt1[0], (byte*)&jv1, 8); //check TDateTime dtad1; dtad1 = ConvertJavaDateTimeToDelphiDateTime(jv1);
原文:http://www.cnblogs.com/cb168/p/6269741.html