假设您不想使用Joda Time(对于Android应用程序可能有点大),您应该使用DateFormat如下SimpleDateFormat:
// See notes below
DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date date = new Date(location.getTime());
String formatted = format.format(date);
Run Code Online (Sandbox Code Playgroud)
但是你应该考虑文化问题:
DateFormat.getDateTimeInstance()DateFormat你创建的任何时区的默认值,但也许是别的...| 归档时间: |
|
| 查看次数: |
6801 次 |
| 最近记录: |