Here you can find the source of addMinutes(Date t, int minutes)
Parameter | Description |
---|---|
t | Der Zeitpunkt. |
minutes | Anzahl an Minuten. |
public static Date addMinutes(Date t, int minutes)
//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; } }