Java8处理日期和时间

版权声明:Yes, I still love you, let me accompany you around, staged an impossible love https://blog.csdn.net/bc_aptx4869/article/details/80323752
        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

        LocalDateTime time = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
        String localTime = df.format(time);
        System.out.println("LocalDateTime转成String类型的时间,并将时分秒设为0:"+localTime);


        LocalDateTime ldt = LocalDateTime.parse("2018-05-15 15:32:59",df);
        System.out.println("String类型的时间转成LocalDateTime:"+ldt);
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页