Java Program to format date in different country format


This Java example will show you how to display date in different languages with different country format



import java.text.DateFormat;
import java.util.*;

public class Main {
   public static void main(String[] args) throws Exception {
      Date date = new Date();
      System.out.println("today is "+ date.toString());    
      Locale locItalian = new Locale("fr","ja");
      DateFormat df = DateFormat.getDateInstance (DateFormat.FULL, locItalian);
      System.out.println("today is in French Language  in Japanies Format : "+ df.format(date));
   }
}

 

 

In the above example we used Locale() object to get french language and japanies format.

 

Output:

today is Wed May 05 13:34:09 UTC 2021
today is in French Language  in Japanies Format : mercredi 5 mai 2021 

JAVA File IO examples

JAVA Date & Time Progamming Examples