//格式化 String tmstr = String.format("%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" , new Date()); System.out.println(tmstr); 输出结果:2015-09-26 12:20:41