1 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 2 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); 3 String datetime = sdf.format(new Date());//new Date()为获取当前系统时间
4 System.out.println(datetime);
1 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 2 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); 3 String datetime = sdf.format(new Date());//new Date()为获取当前系统时间
4 System.out.println(datetime);