caused by computer's local setting.Please read the API:To format a number for a different Locale, specify it in the call to getDateInstance(). DateFormat df = DateFormat.getDateInstance(Locale.US);
我用的是linux 有没有办法更改设置,而不修改文件? 因为我程序里很多地方用到 Date rq1=df1.parse("2001-12-30"); 怎么办/
用SimpleDateFormat: SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd"); GregorianCalendar now = new GregorianCalendar(); Date d = now.getTime(); out.println(df1.format(d));
You do not need to change the system's local setting Just change toDateFormat df = DateFormat.getDateInstance(Locale.CN);Please read the JDK API for more detail.
有没有办法更改设置,而不修改文件?
因为我程序里很多地方用到
Date rq1=df1.parse("2001-12-30");
怎么办/
SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");
GregorianCalendar now = new GregorianCalendar();
Date d = now.getTime();
out.println(df1.format(d));
Calendar MyDate = Calendar.getInstance();
MyDate.setTime(new java.util.Date());
String adddate=df.format(MyDate.getTime()).substring(0,8);SimpleDateFormat("yyyyMMdd");这里你可以定义你的输出格式。
我的问题是,linux中怎么办,
我不想修改程序呀,——————因为那太多了。
http://www.csdn.net/expert/topic/1004/1004416.xml?temp=.9450647