1、调用硬件的接口,返回的数据,存到数据库,时间格式是UTC的
不是北京的,要转一下,北京=UTC+8小时
2、具体代码
public static String forBeiJing(String time){标签:06.000,07,sdf1,ss,12T01,SimpleDateFormat,time,new From: https://www.cnblogs.com/IWishRich/p/17546989.html
try {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
Date date1 = sdf1.parse( time );
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
time = sdf2.format( date1 );
} catch (ParseException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
return time;
}