I need to present a "mask" on a GUI screen representing a date in the current locale's short format, which may include a 4-digit year. How do I know which field is the year? I can get the localized pattern used by the DateFormat object, but the symbols seem to change based on the Locale!
Created May 8, 2012
Joe Sam Shirah Use SimpleDateFormat.toPattern() to get the unlocalized pattern ( as opposed to toLocalizedPattern() ). The returned String uses the symbols referenced in the SimpleDateFormat documentation.
For an example of retrieving/changing this pattern, see How can I create a SHORT-style DateFormat with a four digit year that works for all locales?.