Q:

Joda Time daylight saving day detection

Is there some built-in way to check how many hours a DateTime with DateTimeZone has?
I've written a small utility class, but would prefer a built-in method.
public class Dst {
    public static long dayHours(DateTime instant) {
        Period day = new Period(0, 0, 0, 1, 0, 0, 0, 0);
        return new Duration(instant, instant.plus(day)).getStandardHours();
    }
    public static boolean hasClockChange(DateTime instant) {
        return 24l != Dst.dayHours(instant);
    }
}

A:

I do not think that there is a direct way in the JodaTime library, but maybe some shorter:
public static long dayHours(DateTime instant) {
    return new Duration(instant.withMillisOfDay(0), 
                        instant.withMillisOfDay(0).plus(Days.ONE))
                        .getStandardHours();
}

This is slightly diffrent from what you posted, because it looks at the day represented by the provided date (discarding the time) and not at the next 23/24/25 hours, what you actually do, which will differ depending on whether the time contained in instant is before or after the time change.
The question I am asking myself is, do you really need the number of hours? Or just whether or not there is a change on that day? Then use something like this:
public static boolean hasClockChange(DateTime instant) {
        zone = DateTimeZone.forID("your-time-zone") // or do this with an appropriate constant
        return zone.getOffset(instant.withMillisOfDay(0)) != zone.getOffset(instant.withHourOfDay(23));
}

(Provided the time change will not happen after 11pm, which should be okay).
You could also return -1/0/1 depending on the direction of time change if you need that information.

