new LocalDateTime("1999-12-31T00:00:00Z");
When I try to create this datetime, I get:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid format: "1999-12-31T00:00:00Z" is malformed at "Z"
at org.joda.time.format.DateTimeParserBucket.doParseMillis(DateTimeParserBucket.java:187)
at org.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:780)
at org.joda.time.convert.StringConverter.getPartialValues(StringConverter.java:87)
at org.joda.time.LocalDateTime.<init>(LocalDateTime.java:414)
at org.joda.time.LocalDateTime.<init>(LocalDateTime.java:358)
How can I then parse that date to LocalDateTime?
How can I then parse that date to LocalDateTime?
You can't - LocalDateTime represents a date and time that does not have an associated timezone at all. If you have a timestamp that is anchored to a timezone (UTC in this case) then you should be using DateTime instead of LocalDateTime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With