您的位置:首页 > 其它

DateFormatUtils格式化日期

2013-04-15 14:10 204 查看
date

[java] view plaincopyprint?

Date date = new Date();

System.out.println(DateFormatUtils.ISO_DATE_FORMAT.format(date));

System.out.println(DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.format(date));

System.out.println(DateFormatUtils.ISO_DATETIME_FORMAT.format(date));

System.out.println(DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date));

System.out.println(DateFormatUtils.ISO_TIME_FORMAT.format(date));

System.out.println(DateFormatUtils.ISO_TIME_NO_T_FORMAT.format(date));

System.out.println(DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.format(date));

System.out.println(DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.format(date));

System.out.println(DateFormatUtils.ISO_DATE_FORMAT.format(date) + " " + DateFormatUtils.ISO_TIME_NO_T_FORMAT.format(date));

Date date = new Date();
System.out.println(DateFormatUtils.ISO_DATE_FORMAT.format(date));
System.out.println(DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.format(date));
System.out.println(DateFormatUtils.ISO_DATETIME_FORMAT.format(date));
System.out.println(DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date));
System.out.println(DateFormatUtils.ISO_TIME_FORMAT.format(date));
System.out.println(DateFormatUtils.ISO_TIME_NO_T_FORMAT.format(date));
System.out.println(DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.format(date));
System.out.println(DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.format(date));
System.out.println(DateFormatUtils.ISO_DATE_FORMAT.format(date) + " " + DateFormatUtils.ISO_TIME_NO_T_FORMAT.format(date));


输出:

2011-12-03
2011-12-03+08:00
2011-12-03T14:55:18
2011-12-03T14:55:18+08:00
T14:55:18
14:55:18
14:55:18+08:00
T14:55:18+08:00
2011-12-03 14:55:18

http://blog.csdn.net/jialechan/article/details/7037452
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: