简单的显示时间

 Date dd=new Date();
 String adddate=dd.toLocaleString();



Calendar   rightNow   =   Calendar.getInstance();  
  out.println(rightNow.getTime());



Calendar   now   =   new   GregorianCalendar();  
  System.out.println(now.get(Calendar.YEAR));   //year  
  System.out.println(now.get(Calendar.MONTH)   +   1);//month  
  System.out.println(now.get(Calendar.DAY_OF_MONTH));   //day  
  System.out.println(now.get(Calendar.HOUR_OF_DAY));   //hour  
  System.out.println(now.get(Calendar.MINUTE));   //minute  
  System.out.println(now.get(Calendar.SECOND));   //second  
  System.out.println(now.get(Calendar.MILLISECOND));   //ms  

你可能感兴趣的:(时间)