get After Date - Java java.util

Java examples for java.util:Calendar Calculation

Description

get After Date

Demo Code


//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static void main(String[] argv) throws Exception {
        Date currentDate = new Date();
        System.out.println(getAfterDate(currentDate));
    }/*from   w  w w.  ja v  a  2s  . com*/

    public static Date getAfterDate(Date currentDate) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(currentDate);
        calendar.add(Calendar.DAY_OF_YEAR, 1);
        return calendar.getTime();
    }
}

Related Tutorials