日期:2014-05-20 浏览次数:20780 次
/**
* 获取两个日期之间的天数
*
* @param date1
* @param date2
* @return
*/
public static long dateDiffer(Date date1, Date date2) {
return (date1.getTime() - date2.getTime()) / (1000 * 3600 * 24);
}
public static long getDay() throws ParseException{
DateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
String s1 = "201307130923";
String s2 = "201308221435";
Date d1 = df.parse(s1);
Date d2 = df.parse(s2);
return (d2.getTime() - d1.getTime()) / (1000 * 3600 * 24);
}