java 时间格式化函数

 1 java.util.Date
 2 java.text.DateFormat;
 3 java.text.SimpleDateFormat;
 4  
 5 class lesson1{
 6     
 7     public static void main(String []args)
 8     {
 9           Date d1=new Date();
10           DateFormat d2=new SimpleDateFormat("yyy-mm-dd");
11           String str1=d2.format(d1);
12           System.out.print(str1);
13      } 
14     
15 }        
  //时间格式化函数操作如上

 

posted @ 2016-10-11 19:12  dr追梦  阅读(678)  评论(0)    收藏  举报