计算当前日期的前一天、后一天

当前日期的前一天

public static Date getBeforeDay(Date date) {  
        Calendar calendar = Calendar.getInstance();  
        calendar.setTime(date);  
        calendar.add(Calendar.DAY_OF_MONTH, -1);  
        date = calendar.getTime();  
        return date;  
    }  


当前日期的后一天

public static Date getNextDay(Date date) {  
        Calendar calendar = Calendar.getInstance();  
        calendar.setTime(date);  
        calendar.add(Calendar.DAY_OF_MONTH, +1);  
        date = calendar.getTime();  
        return date;  
    } 





你可能感兴趣的:(计算当前日期的前一天、后一天)