Skip to content
Advertisement

Date formatting according to country habbits

We create J2SE application that has to format the date and time according to custom the country from which users come from. I want to ask how to solve this thing in Java? Probably I’ll use SimpleDateFormat, but I wonder if it is possible to get format string in somehow simpler way than to have all format strings for each country separately.

Advertisement

Answer

DateFormat already allows you to do this – just use DateTimeFormat.getDateTimeInstance(dateStyle, timeStyle, locale) or something similar, depending on your needs.

6 People found this is helpful
Advertisement