import java.util.Date;
import java.util.Locale;
public class localeDate {
public static void main(String[] args) {
Date date =new Date();
//%tB表示指定语言环境的月份全称
String strDateUS="",strDateCn="";
strDateUS =String.format(Locale.US,"\n英语环境的月份全称:%tB",date);
strDateCn =String.format(Locale.CHINA,"汉语环境的月份全称:%tB\n",date);
System.out.println(strDateUS);
System.out.println(strDateCn);
//%tb指定语言环境的月份简称
strDateUS =String.format(Locale.US,"英语环境的月份简称:%tb",date);
strDateCn =String.format(Locale.CHINA,"汉语环境的月份简称:%tb\n",date);
System.out.println(strDateUS);
System.out.println(strDateCn);
//%tA指定语言环境的星期几全称
strDateUS =String.format(Locale.US,"英语环境的星期几全称:%tA",date);
strDateCn =String.format(Locale.CHINA,"汉语环境的星期几全称:%tA\n",date);
System.out.println(strDateUS);
System.out.println(strDateCn);
//%ta指定语言环境的星期几简称
strDateUS =String.format(Locale.US,"英语环境的星期几简称:%ta",date);
strDateCn =String.format(Locale.CHINA,"汉语环境的星期几简称:%ta",date);
System.out.println(strDateUS);
System.out.println(strDateCn);
System.err.println("\n2011.12.04 Sunday By friendan!");
}
}
--转自
该贴由koei123转至本版2015-7-14 11:08:51