美文网首页
ZonedDateTime转String

ZonedDateTime转String

作者: Aluha_f289 | 来源:发表于2019-08-11 17:03 被阅读0次
        ZonedDateTime now = ZonedDateTime.now();
        DateTimeFormatter beijingFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.of("Asia/Shanghai"));
        String nowTimeStr = beijingFormatter.format(now);
        String begin = nowTimeStr.substring(0, 10) + " 00:00:00";
        String end = nowTimeStr.substring(0, 10) + " 23:59:59";

相关文章

网友评论

      本文标题:ZonedDateTime转String

      本文链接:https://www.haomeiwen.com/subject/gxesjctx.html