Java获取当前系统时间
//导入import java.util.Date;import java.text.DateFormat;import java.text.SimpleDateFormat; Date dt=new Date();//如果不需要格式,可直接用dt,dt就是当前系统时间DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");//设置显示格式String nowTime="";nowTime= df.format(dt);//用DateFormat的format()方法在dt中获取并以yyyy/MM/dd HH:mm:ss格式显示System.out.println("当前时间<毫秒>:"System.currentTimeMillis());//输出毫秒时间
页:
[1]