I need to convert string in 2000-11-10T00:00:00+02:00 format to LocalDateTime object. But when I parse this string to LocalDateTime, it gives error.
Which pattern should I use to parse the string to LocalDateTime object?
Advertisement
Answer
Your string contains time zone and LocalDateTime
does not contgain this information. You need to use OffsetDateTime class or ZonedDateTime class. The information on the masks is provided in Javadoc for DateTimeFormatter class.
OffsetDateTime odt = OffsetDateTime.parse( "2000-11-10T00:00:00+02:00" ) ;