}
/*************************
* 判断传入的Date类型时间是否和当前系统时间相等
* @param date 和当前系统时间比较的时间
* @return boolean
*/
public static boolean isEqualsCurrentDate(Date date){
return (date.getTime()==(new Date().getTime())) true:false;
}
/*************************
* 获取两个时间间隔的天数,如果返回值大于0,则表示startDate>endDate
* @param startDate Date类型
* @param endDate Date类型
* @return 间隔天数
*/
public static int getSeparateDay(Date startDate,Date endDate){
return (int) ((startDate.getTime()-endDate.getTime())/(24 * 60 * 60 * 1000));
}
/*************************
* 获取两个时间间隔的天数,如果返回值大于0,则表示startDate>endDate
* @param startDate String类型
* @param endDate String类型
* @return 间隔天数
* @throws ParseException
*/
public static int getSeparateDay(String startDate, String endDate) throws ParseException{
DateFormat df = new SimpleDateFormat(format7);
return (int) ((df.parse(startDate).getTime()-df.parse(endDate).getTime())/(24 * 60 * 60 * 1000));
}
/****************************
* 得到一个时间延后多少天之后的时间
* @param nowDay String类型的时间
* @param delay 前移或后延的天数
* @return 返回String类型时间
* @throws ParseException
*/
public static String getMoveDay(String nowDay, int delay) throws ParseException{
DateFormat df = new SimpleDateFormat(format7);
Date d = stringParseToDate7(nowDay);
long myTime = (d.getTime() / 1000) + delay * 24 * 60 * 60;
d.setTime(myTime * 1000);
return df.format(d);
}
/****************************
* 得到当前时间延后多少天之后的时间
* @param nowDay String类型的时间
* @return 返回Date类型时间
* @throws ParseException
*/
public static Date getMoveDay(int delay) throws ParseException{
DateFormat df = new SimpleDateFormat(format7);
Date d = new Date();
long myTime = (d.getTime() / 1000) + delay * 24 * 60 * 60;
d.setTime(myTime * 1000);
return df.parse(df.format(d));
}
/*********************
* 判断是否润年
* @param date Date类型时间
* @return boolean
*/
public static boolean isLeapYear(Date date) {
GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance();
gc.setTime(date);
int year = gc.get(Calendar.YEAR);
if ((year % 400) == 0)
return true;
else if ((year % 4) == 0) {
if ((year % 100) == 0)
return false;
else
return true;
} else
return false;
}
/*********************
* 判断是否润年
* @param date String类型时间
* @return boolean
* @throws ParseException
*/
public static boolean isLeapYear(String date) throws ParseException {
DateFormat df = new SimpleDateFormat(format7);
Date d = df.parse(date);
GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance();
gc.setTime(d);
int year = gc.get(Calendar.YEAR);
if ((year % 400) == 0)
return true;
else if ((year % 4) == 0) {
if ((year % 100) == 0)
return false;
else