ZonedDateTime转String

2019-08-11  本文已影响0人  Aluha_f289
        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";
上一篇下一篇

猜你喜欢

热点阅读