Java Display Time In Different Country's Format
Chapter:
Date and Time
Last Updated:
02-09-2016 08:49:36 UTC
Program:
/* ............... START ............... */
import java.text.DateFormat;
import java.util.*;
public class JavaCountryTimeFormat {
public static void main(String[] args) throws Exception {
Date date = new Date();
System.out.println("today is "+ date.toString());
Locale locItalian = new Locale("it","ch");
DateFormat df = DateFormat.getDateInstance
(DateFormat.FULL, locItalian);
System.out.println("today is in Italian Language in "
+ "Switzerland Format : "+ df.format(date));
}
}
/* ............... END ............... */
Output
today is Fri Sep 02 12:46:07 IST 2016
today is in Italian Language in Switzerland Format : venerdì, 2. settembre 2016
Tags
Display Time In Different Country's Format, Java, Date And Time