java计算年度剩余天数
输入日期 计算当年天数
public static int parseRemainDays(String strDate){
if(strDate==null || strDate.isEmpty() || strDate.length()<10){
return -1;
}
SimPleDateFormat sm = new SimPleDateFormat(strDate.length()>18?"yyyy-MM-dd HH:mm:ss":"yyyy-MM-dd");
Date date=null;
try{
date=sm.parse(strDate);
}catch(ParseException ex){
ex.printStackTrace();
return -1;
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.getActualMaximum(Calendar.DAY_OF_YEAR) - calendar.get(Calendar.DAY_OF_YEAR)
}