I'm trying to parse timestamps from a data source that is defined as using RFC1123-compatible date time specifications. My code is:
value = Instant.from (DateTimeFormatter.RFC_1123_DATE_TIME.parse (textValue));
This works fine for some data, but I get exceptions for strings that contain zone names, even ones that are defined in RFC2822 (which is indirectly referenced from RFC1123 because it obsoletes RFC822). Examples:
java.time.format.DateTimeParseException: Text 'Sun, 20 Aug 2017 00:30:00 UT' could not be parsed at index 26
java.time.format.DateTimeParseException: Text 'Mon, 21 Aug 2017 15:00:00 EST' could not be parsed at index 26
How do I persuade DateTimeFormatter
to accept this type of date?
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