Hay*_*yan 3 android date simpledateformat
我有这个功能
private void setDateInTopBar() {
Date bodyPartDate = DataManager.instance().getSelectedBodyPart().getPublicationDate();
SimpleDateFormat format = new SimpleDateFormat("dd/mm/yyyy");
String formattedDate = format.format(bodyPartDate);
TextView dateTxt = (TextView) findViewById(R.id.txtImageDate);
dateTxt.setText(formattedDate);
}
Run Code Online (Sandbox Code Playgroud)
但我的月份是0,当日和年工作正常时,问题是什么?
Ner*_*een 19
更换:
SimpleDateFormat format = new SimpleDateFormat("dd/mm/yyyy");
Run Code Online (Sandbox Code Playgroud)
附:
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
Run Code Online (Sandbox Code Playgroud)
作为mm分钟的参考..检查http://developer.android.com/reference/java/text/SimpleDateFormat.html
| 归档时间: |
|
| 查看次数: |
9153 次 |
| 最近记录: |