I am having difficulty using JodaTime to handle Daylight savings time.
String time = "3:45-PM";
DateTimeFormatter formatter = DateTimeFormat.forPattern("KK:mm-a");
DateTime dt = formatter.parseDateTime(time).withZone(DateTimeZone.forID("America/New_York"));
dt = dt.toDateTime(DateTimeZone.UTC);
startDate = startDate.withHourOfDay(dt.getHourOfDay()).withMinuteOfHour(dt.getMinuteOfHour());
Output from this code snippet ends up being:
2015-04-08 16:46:51.952 INFO 12244 --- [nio-8080-exec-1] VALUES PULLED : 03:45-PM
2015-04-08 16:46:51.952 INFO 12244 --- [nio-8080-exec-1] VALUES PULLED : 08:45-PM
Currently, the time is 5 hours off. Which is not handling Daylights saving time. How do I get Joda Time to take DLS into account?