Java Day Next nextDay(Date date)

Here you can find the source of nextDay(Date date)

Description

Returns a new date with 1 day after the given date (others fields are untouched)

License

Open Source License

Parameter

Parameter Description
date a parameter

Declaration

public static Date nextDay(Date date) 

Method Source Code

//package com.java2s;
/**//  w ww.j av a2 s . com
 * Copyright (C) 2015 Yoann Manvieu
 *
 * This software is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

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

public class Main {
    /**
     * Returns a new date with 1 day after the given date (others fields are
     * untouched)
     * 
     * @param date
     */
    public static Date nextDay(Date date) {
        Calendar nextDayFirstDetectionDate = Calendar.getInstance();
        nextDayFirstDetectionDate.setTime(date);
        nextDayFirstDetectionDate.add(Calendar.DAY_OF_MONTH, 1);
        return nextDayFirstDetectionDate.getTime();
    }
}

Related

  1. nextDay(Date d)
  2. nextDay(Date date)
  3. nextDay(Date date)
  4. nextDay(Date date)
  5. nextDay(Date date)
  6. nextDay(Date then)