首页 > 编程语言 > 详细

【笔记——java时间格式化】java中的时间格式化工具

时间:2014-12-14 18:31:05      阅读:277      评论:0      收藏:0      [点我收藏+]
 1     /**
 2      * 格式化日期为 年-月-日
 3      * @param time
 4      * @return
 5      */
 6     public static String formatDate(Date time){
 7         Formatter formatter = new Formatter();
 8         formatter.format("%tF %tT", time,time);
 9         String ti = formatter.toString();
10         formatter.close();
11         return ti;
12     }
13     
14     
15     public static String formatShortDate(Date time){
16         Formatter formatter = new Formatter();
17         formatter.format("%tF", time);
18         String ti = formatter.toString();
19         formatter.close();
20         return ti;
21     }

 

【笔记——java时间格式化】java中的时间格式化工具

原文:http://www.cnblogs.com/kirno/p/4162733.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!