public void testTime(){
// TODO Auto-generated method stub
int year=0;
int month=0;
int day=0;
Calendar c=Calendar.getInstance();//获得系统当前日期
int hour=c.get(Calendar.HOUR_OF_DAY);
int minute=c.get(Calendar.MINUTE);
int second=c.get(Calendar.SECOND);
year=c.get(Calendar.YEAR);
month=c.get(Calendar.MONTH)+1;//系统日期从0开始算起
day=c.get(Calendar.DAY_OF_MONTH);
System.out.println(year+"年"+month+"月"+day+"日"+hour+"时"+minute+"分"+second+"秒");
// TODO Auto-generated method stub
int year=0;
int month=0;
int day=0;
Calendar c=Calendar.getInstance();//获得系统当前日期
int hour=c.get(Calendar.HOUR_OF_DAY);
int minute=c.get(Calendar.MINUTE);
int second=c.get(Calendar.SECOND);
year=c.get(Calendar.YEAR);
month=c.get(Calendar.MONTH)+1;//系统日期从0开始算起
day=c.get(Calendar.DAY_OF_MONTH);
System.out.println(year+"年"+month+"月"+day+"日"+hour+"时"+minute+"分"+second+"秒");
}
//结果预览
2012年10月22日12时26分31秒