Ron*_*nie 4 java format date simpledateformat
我试着用这个SimpleDateFormat类来做这个,但是我没有找到任何在一天之后放置'st'的选项.我只能得到 '2000年12月31日'
如何格式像"2000年12月31日".我的日期是毫秒.
在java中是否有任何API可以让我们以这种方式格式化日期?
Vin*_*esh 14
一个带开关盒的简单功能,这样做
Public String getDateSuffix( int day) {
switch (day) {
case 1: case 21: case 31:
return ("st");
case 2: case 22:
return ("nd");
case 3: case 23:
return ("rd");
default:
return ("th");
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5921 次 |
| 最近记录: |