Convert Date to Locale Format in Java

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;


public class Test {
public static void main(String[] args) {
DateFormat localeDateFormat;
Locale[] locales = { Locale.CANADA, Locale.FRANCE, Locale.GERMANY,
Locale.US, Locale.JAPAN };
for (Locale locale : locales) {
localeDateFormat = DateFormat.getDateInstance(DateFormat.LONG,
locale);
System.out.println("Date Format : "
+ locale.getDisplayCountry()
+ " :: "
+ ((SimpleDateFormat) DateFormat.getDateInstance(
DateFormat.LONG, locale)).toPattern() + " :: "
+ localeDateFormat.format(new Date()));
}
}
}


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email