importjava.text.SimpleDateFormat;importjava.util.Calendar;importjava.util.Date;public classMainActivity {/*public static void main(String[] args) {
// TODO Auto-generated method stub
int[] A = { 1,8,2,5,4,3,6 };
int[] B = Insertion.sort(A);
print(B);
}
static void print(int[] arr) {
for(int i=0; i
System.out.print(arr[i]+" ");
}
}*/
public static void main(String[] args) throwsException{/*Date date1 = new SimpleDateFormat("yyyy-MM-dd").parse("2015-04-24 12:14:57");
Date date2 = new SimpleDateFormat("yyyy-MM-dd").parse("2015-03-25 12:14:57");
Calendar cal1=Calendar.getInstance();
Calendar cal2=Calendar.getInstance();
cal1.setTime(date1);
cal2.setTime(date2);
System.out.println(date1.compareTo(date2));
System.out.println(cal1.compareTo(cal2));
String now = new SimpleDateFormat("yyyy年MM月dd日").format(date1);
System.out.println(now);*/SimpleDateFormat df= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Date now= df.parse("2015-04-24 12:14:57");
java.util.Date date=df.parse("2015-03-25 12:14:57");long l=now.getTime()-date.getTime();long day=l/(24*60*60*1000);long hour=(l/(60*60*1000)-day*24);long min=((l/(60*1000))-day*24*60-hour*60);long s=(l/1000-day*24*60*60-hour*60*60-min*60);
System.out.println(""+day+"天"+hour+"小时"+min+"分"+s+"秒");
}
}