最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Android开发时间日期格式国际化实现方法
时间:2013-05-10 编辑:简简单单 来源:一聚教程网
DateFormat helps you to format and parse dates for any locale. Your code can be completely independent of the locale conventions for months, days of the week, or even the calendar format: lunar vs. solar.
To format a date for the current Locale, use one of the static factory methods:
代码如下 | 复制代码 |
myString = DateFormat.getDateInstance().format(myDate); |
If you are formatting multiple dates, it is more efficient to get the format and use it multiple times so that the system doesn't have to fetch the information about the local language and country conventions multiple times.
代码如下 | 复制代码 |
DateFormat df = DateFormat.getDateInstance(); |
To format a number for a different locale, specify it in the call to getDateInstance:
代码如下 | 复制代码 |
DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE); |
DateFormat can also be used to parse strings:
代码如下 | 复制代码 |
myDate = df.parse(myString); |
例子
代码如下 | 复制代码 |
public static CharSequence formatTimeInListForOverSeaUser( |
相关文章
- sora软件价格介绍 02-22
- sora官网入口地址一览 02-22
- Sora生成的视频使用教程 02-22
- 《梦幻西游》元宵灯谜线索答案大全2024 02-22
- 《原神》有朋自远方来第一天通关攻略 02-22
- 《苏醒之路》四个结局达成攻略 02-22