DateFormatUtils格式化日期

  1. Date date = new Date();  
  2. System.out.println(DateFormatUtils.ISO_DATE_FORMAT.format(date));  
  3. System.out.println(DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.format(date));  
  4. System.out.println(DateFormatUtils.ISO_DATETIME_FORMAT.format(date));  
  5. System.out.println(DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date));  
  6. System.out.println(DateFormatUtils.ISO_TIME_FORMAT.format(date));  
  7. System.out.println(DateFormatUtils.ISO_TIME_NO_T_FORMAT.format(date));  
  8. System.out.println(DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.format(date));  
  9. System.out.println(DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.format(date));  
  10. 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

你可能感兴趣的:(DateFormat)