Nid*_*dhi 1 android android-date android-calendar
我想将日期和时间从"2014-11-25 14:30"格式转换为"2014年11月25日下午2:30".有人可以告诉你怎么做吗?
谢谢!
试试以下代码:
String date = "2014-11-25 14:30";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:MM");
Date testDate = null;
try {
testDate = sdf.parse(date);
}catch(Exception ex){
ex.printStackTrace();
}
SimpleDateFormat formatter = new SimpleDateFormat("MMM dd,yyyy hh:mm a");
String newFormat = formatter.format(testDate);
System.out.println(".....Date..."+newFormat);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4600 次 |
| 最近记录: |