I realize that you can check if a Date is inDaylightTime, but how can I determine when (or if) that Date switches to and from DST? I can iterate over every day and check if it’s inDaylightTime, but is there a cleaner solution/method?
I realize that you can check if a Date is inDaylightTime , but how
Share
I would suggest using Joda Time – its
DateTimeZoneclass hasnextTransitionandpreviousTransitionmethods.Note that transitions can occur for reasons other than DST – a change in standard time, or perhaps a change in the name of the zone interval. But that’s how you’d find out, anyway 🙂
(Joda Time is a much better date and time library to start with, to be honest.)