public static String getDays(Object date){
if(null!=date){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date SD=null;
try {
SD = sdf.parse(date.toString());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//获取天数
long days = (SD.getTime())/(24*60*60*1000);
return days+"";
}else{
return "";
}
}
时间: 2024-10-11 02:49:40