public static void main(String[] args) throws Exception{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
String date1 = "2001-01-01 08:12:01";
String date2 = "2001-01-01 08:11:06";
Date d1 = new Date();
Date d2 = sdf.parse(date2);
long time = (d1.getTime()-d2.getTime())/1000;
System.out.println(new Date());
System.out.println("时间差:" + time);
}