get Next Day - Java java.util

Java examples for java.util:Day

Description

get Next Day

Demo Code


//package com.java2s;

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

public class Main {
    public static void main(String[] argv) throws Exception {
        Date currentday = new Date();
        System.out.println(getNextDay(currentday));
    }// w ww  .j av a2 s  . co  m

    public static final String DATE = "dd/MM/yyyy";

    public static Date getNextDay(Date currentday) {
        Calendar calendar = getCalendar();
        calendar.setTime(currentday);
        calendar.add(Calendar.DATE, 1);
        return calendar.getTime();
    }

    public static Calendar getCalendar() {
        return GregorianCalendar.getInstance();
    }
}

Related Tutorials