67,512
社区成员
发帖
与我相关
我的任务
分享
final String data = "07 14 6c 60 a9 1e 02 ac";
String array[] = data.split("\\s");
String hex = array[3]+array[2]+array[1]+array[0];
int time = Integer.parseInt(hex, 16) - 0x1E13380;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String result = sdf.format(new Date(time * 1000L));
System.out.println(result);
输出结果:2020-04-06 15:55:51
[/quote]
里面 “- 0x1E13380”是什么意思呢 ?这个是什么?
final String data = "07 14 6c 60 a9 1e 02 ac";
String array[] = data.split("\\s");
String hex = array[3]+array[2]+array[1]+array[0];
int time = Integer.parseInt(hex, 16) - 0x1E13380;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String result = sdf.format(new Date(time * 1000L));
System.out.println(result);
输出结果:2020-04-06 15:55:51