Application: a digital clock. I want to know whether the current date should be displayed as mm.dd.yy or dd.mm.yy for the current locale. Bonus points for identifying yy.mm.dd cases. (I an perfectly content to not support non-Gregorian calendars).
So for example: Should January 31, 2019 be displayed as 01.31.19, or 31.01.19.
Being able to get a short date format string would suffice. i.e. "MM/dd/yy", or "yy.MM.dd".
I've rummaged through DateFormat
, and SimpleDateFormat
(the latter of which has what I need in the pattern
private member, but doesn't provide public access). But as usual, date support in Java is infuriatingly... complicated. :-(