获取一些常用时间段

java 世界标准时间UTC时间转北京时间GST

2019-07-16  本文已影响0人  _嘛喳喳_
    String formatPattern = "yyyy-MM-dd HH:mm:ss";
    String utc = "2019-07-10T16:00:00.000Z";
    ZonedDateTime zdt  = ZonedDateTime.parse(utc);
    LocalDateTime localDateTime = zdt.toLocalDateTime();
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern(formatPattern);
    String gst = formatter.format(localDateTime.plusHours(8));
上一篇下一篇

猜你喜欢

热点阅读