Name: dk106046 Date: 05/15/2002
Full JDK version(s) (from java -version) : JDK 1.2.2 , JDK 1.3.0 , JDK 1.3.1 and JDK 1.4
1. Compile and run the DateDemo.java testcase below.
2. While running this testcase, run separately on a Win2K Japanese, Simplified Chinese and Traditional Chinese machines and observe that the Day of the week is not a part of the output while the day of the week appears in the English Locale.
import java.util.*;
import java.text.*;
public class DateDemo
{
public static void main(String args[])
{
Locale loc = Locale.getDefault();
String encode = loc.getLanguage() + "_" + loc.getCountry();
System.out.println(encode);
Date now = new Date();
DateFormat s = DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL,loc);
System.out.println(s.format(now));
Locale us = Locale.US;
encode = us.getLanguage() + "_" + us.getCountry();
System.out.println(encode);
s = DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL,us);
System.out.println(s.format(now));
}
}
======================================================================