String to OffsetDateTime parse in java
问题 I am trying to parse date string to OffsetDateTime as below. But I am getting below exception, Exception in thread "main" java.time.format.DateTimeParseException: Text 'Mon Jun 18 00:00:00 IST 2012' could not be parsed at index 0 public class ParseExample { public static void main(String... args) throws ParseException { String dateStr = "Mon Jun 18 00:00:00 IST 2012"; System.out.println(OffsetDateTime.parse(dateStr)); } } can someone please help me with this mistake. Thanks. 回答1: