adsense


Sunday, 25 October 2015

JAVA EXAMPLES DISPLAY TIME IN ITALIAN LANGUAGE PAGE 69

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



JAVA EXAMPLES DISPLAY TIME IN ITALIAN LANGUAGE



Java Examples - Display time in Italian Language

Problem Description:
How to display time in different languages?
Solution:
This example uses DateFormat class to display time in Italian.
import java.text.DateFormat;
import java.util.*;

public class Main {
   public static void main(String[] args) throws Exception {
      Date d1 = new Date();
      System.out.println("today is "+ d1.toString()); 
      Locale locItalian = new Locale("it");
      DateFormat df = DateFormat.getDateInstance
      (DateFormat.FULL, locItalian);
      System.out.println("today is "+ df.format(d1));
   }
}
Result:
The above code sample will produce the following result.
today is Sat Feb 22 23:59:54 CST 2014
today is sabato 22 febbraio 2014


No comments: