转载于https://blog.csdn.net/qq_36692282/article/details/105203220?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param
public static final SimpleDateFormat DATE_TIME_ZONE = new SimpleDateFormat(“yyyy-MM-dd’T’HH:mm:ss.SSSZ”);
/**
- 得到格林时间 格式:2020-02-25T16:00:00.00Z
- @param s
- @return
*/
public static String timeTZ(long s) {
String time1 = DateUtils.date2String(s, “yyyy-MM-dd HH:mm:ss”);
Date time = null;
String result = null;
try {
time = DEFAULT_DATE_FORMAT.parse(time1);
result = DATE_TIME_ZONE.format(time);
} catch (ParseException e) {
e.printStackTrace();
}
return result.replace("+0800", “Z”);
}