jai*_*nal 0 java android date-format
如何获得这样的日期格式?
Saturday,Dec 11,2011
Run Code Online (Sandbox Code Playgroud)
编辑:
我的代码部分如下:
String outDate = "";
Date dT = new Date(year, mon, day);
SimpleDateFormat sdf = new SimpleDateFormat("EEE,MMM dd,yyyy");
outDate = sdf.format(dT);
and its output is `Sat,Dec 02,3911` when year = 2011,mon = 11,day = 2;
Run Code Online (Sandbox Code Playgroud)
输出错误月份和年份的原因是什么?
您可以使用SimpleDateFormat.
尝试:
SimpleDateFormat formatter = new SimpleDateFormat("EEEE,MMM dd,yyyy");
String text = formatter.format(...);
Run Code Online (Sandbox Code Playgroud)
这将使用默认语言环境 - 相应地调整另一个.
| 归档时间: |
|
| 查看次数: |
2459 次 |
| 最近记录: |