- String dateTime="";
- java.util.Date dt=new java.util.Date();
- //System.out.print(dt); //输出结果是:Wed Aug 10 11:29:11 CST xxxx
- SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- //System.out.print(sdf.format(dt)); //输出结果是:yyyy-MM-dd HH:mm:ss
- dateTime = sdf.format(dt);