I found another way that was slightly less circular than the accepted answer:
DateFormat format; // ... boolean is24Hour; if (format instanceof SimpleDateFormat) { SimpleDateFormat sdf = (SimpleDateFormat)format; String pattern = sdf.toPattern(); is24Hour = !pattern.contains("a"); }
Still pretty rude, and it wonβt work with other specific DateFormat types, but the standard ways to get a DateFormat object seem to return SimpleDateFormat .
shawkinaw
source share