LocalDateTime

     //  LocalDateTime类: 获取日期时间信息。格式为 2018-09-06T15:33:56.750
        //  得到指定日期时间
        LocalDateTime dateTime = LocalDateTime.of(1985, 4, 15, 12, 12, 12);
        //  得到当前日期时间
        LocalDateTime localDateTime = LocalDateTime.now();
        //  获取日期时间信息
        int year1 = localDateTime.getYear();
        log.debug("year1===={}",year1);
        int monthValue1 = localDateTime.getMonthValue();
        log.debug("monthValue1===={}",monthValue1);
        int dayOfMonth1 = localDateTime.getDayOfMonth();
        log.debug("dayOfMonth1===={}",dayOfMonth1);
        int hour1 = localDateTime.getHour();
        log.debug("hour1===={}",hour1);
        int minute1 = localDateTime.getMinute();
        log.debug("minute1===={}",minute1);
        int second1 = localDateTime.getSecond();
        log.debug("second1===={}",second1);
        int nano1 = localDateTime.getNano();
        log.debug("nano1===={}",nano1);

 

出处:http://www.cnblogs.com/LHH916/