UTC转时间戳,转指定格式

UTC转时间戳,转指定格式

2023-06-29T03:15:48.000Z转为2023-06-29 11:15:48

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sdfUtc = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
sdfUtc.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date = sdfUtc.parse(value);
String value = sdf.format(date);
posted @ 2023-07-05 18:16  musecho  阅读(106)  评论(0编辑  收藏  举报