有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Java 8 LocalDateTime和DateTimeFormatter

下面是thorws异常的一段代码。。我做错什么了吗

DateTimeFormatter  FORMATTER    = DateTimeFormatter.ofPattern(
                                        "ddMMuuuuHHmmssSSS"
                                    );      
    String currentTime=FORMATTER.format(LocalDateTime.now());
    System.out.println(currentTime);
    LocalDateTime parsedTime=LocalDateTime.parse(currentTime,FORMATTER);


09042016161444380
Exception in thread "main" java.time.format.DateTimeParseException: Text '09042016161444380' could not be parsed at index 4
at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949)
at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851)
at java.time.LocalDateTime.parse(LocalDateTime.java:492)

共 (0) 个答案