tag:blogger.com,1999:blog-8712770457197348465.post8446777622026113783..comments2024-03-28T02:47:19.159-07:00Comments on Javarevisited: How to format/parse dates with LocalDateTime in Java 8 - Example Tutorialjavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8712770457197348465.post-62856271181612229642017-08-09T06:30:55.883-07:002017-08-09T06:30:55.883-07:00@Anonymous, yes, pattern must match exactly with t...@Anonymous, yes, pattern must match exactly with the date, otherwise you will receive, java.time.format.DateTimeParseException. Btw, thanks for sharing your input about SimpleDateFormat, didn't know that it handle this case :-) javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-75770644344667335832017-08-09T06:13:57.881-07:002017-08-09T06:13:57.881-07:00I'm getting an exception for this:
Str...I'm getting an exception for this:<br /> String date = "2017-03-08 12:30:54";<br /> DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");<br /> LocalDateTime dateTime = LocalDateTime.parse(date, format);<br />Exception:<br />Exception in thread "main" java.time.format.DateTimeParseException: Text '2017-03-08 12:30:54Anonymousnoreply@blogger.com