赞
踩
lic static void main(String[] args) {
Date nowTime=new Date();// TODO Auto-generated method stub
System.out.println("本机的当前时间:"+nowTime);
Calendar calendar=Calendar.getInstance();
calendar.setTime(new Date());
int year= calendar.get(Calendar.YEAR);
int month=calendar.get(Calendar.MONTH);
int day=calendar.get(Calendar.DAY_OF_MONTH);
int hour=calendar.get(Calendar.HOUR_OF_DAY);
int minute=calendar.get(Calendar.MINUTE);
int second=calendar.get(Calendar.SECOND);
System.out.print("现在的时间:");
System.out.print(""+year+"年"+month+"月"+day+"日");
System.out.print(""+hour+"时"+minute+"分"+second+"秒");
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。