Why can\'t I parse the following date?
DateTime.parse(\"2015-03-29 02:35:00\", DateTimeFormat.forPattern(\"yyyy-MM-dd HH:mm:ss\"));
Result:
As this link explains:
Joda-Time only allows the key classes to store valid date-times. For example, 31st February is not a valid date so it can't be stored (except in Partial). The same principle of valid date-times applies to daylight savings time (DST). In many places DST is used, where the local clock moves forward by an hour in spring and back by an hour in autumn/fall. This means that in spring, there is a "gap" where a local time does not exist. The error "Illegal instant due to time zone offset transition" refers to this gap. It means that your application tried to create a date-time inside the gap - a time that did not exist. Since Joda-Time objects must be valid, this is not allowed.
You are referencing a datetime that does not exist due to daylight savings time changes.
A solution is to use parseLocalDateTime
instead.