Java Minute Add addMinutes(Date t, int minutes)

Here you can find the source of addMinutes(Date t, int minutes)

Description

Addiert minuten Minuten auf den Zeitpunkt.

License

Open Source License

Parameter

Parameter Description
t Der Zeitpunkt.
minutes Anzahl an Minuten.

Return

Das neue Datum, oder das alte Datum wenn minuten gleich 0.

Declaration

public static Date addMinutes(Date t, int minutes) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 Dominik Halfkann, Michael Backhaus, Benjamin Kramer,
 * Fabian K?nig, Karl Stelzner, Stefan Noll and Alexander Schieweck.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html/* w ww . jav  a  2  s .c  o m*/
 ******************************************************************************/

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

public class Main {
    private static Calendar c1 = Calendar.getInstance();

    /**
     * Addiert <b>minuten</b> Minuten auf den Zeitpunkt.
     * @param t Der Zeitpunkt.
     * @param minutes Anzahl an Minuten.
     * @return Das neue Datum, oder das alte Datum wenn minuten gleich 0.
     */
    public static Date addMinutes(Date t, int minutes) {
        if (minutes == 0)
            return t;
        c1.setTime(t);
        c1.add(Calendar.MINUTE, minutes);
        t = c1.getTime();
        return t;
    }
}

Related

  1. addMinutes(Date date, int minutes)
  2. addMinutes(Date in, int minutes)
  3. addMinutes(java.util.Date date, long... minutes)
  4. addMinutesToDate(Date initialDateInMillis, Integer minutesToAdd)
  5. addMinutesToDate(final Date d, final int minutes)