Java DateFormat format Date with DEFAULT and FRENCH Locale

Description

Java DateFormat format Date with DEFAULT and FRENCH Locale


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

public class Main {
  public static void main(String[] args) throws Exception {
    Locale currentLocale = new Locale("fr", "FR");

    DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT, currentLocale);
    Date today = new Date();
    String dateOut = dateFormatter.format(today);

    System.out.println(dateOut + "   " + currentLocale.toString());
  }//from w  w w .ja v  a  2  s.c o  m
}



PreviousNext

Related