java8中的时间处理6 - 格式化

下面是格式化和解析的粒子:

        LocalDate date = LocalDate.now();
        
        System.out.println(date);
        
        System.out.println(date.format(DateTimeFormatter.ofPattern("d::MMM::uuuu")));
        System.out.println(date.format(DateTimeFormatter.BASIC_ISO_DATE));


        LocalDateTime dateTime = LocalDateTime.now();
        
        System.out.println(dateTime);
        
        System.out.println(dateTime.format(DateTimeFormatter.ofPattern("d::MMM::uuuu HH::mm::ss")));
        System.out.println(dateTime.format(DateTimeFormatter.BASIC_ISO_DATE));

        Instant timestamp = Instant.now();
        
        System.out.println(timestamp);

        
        LocalDateTime dt = LocalDateTime.parse("27::四月::2014 21::39::48",
                DateTimeFormatter.ofPattern("d::MMM::uuuu HH::mm::ss"));
        System.out.println(dt);

 

上一篇:DBCA响应文件建库报模版不存在解决办法


下一篇:IE页面关闭前弹出窗口 是否保存信息