Android Date Add addMinutes(Date date, int amount)

Here you can find the source of addMinutes(Date date, int amount)

Description

add Minutes

Declaration

public static Timestamp addMinutes(Date date, int amount) 

Method Source Code

//package com.java2s;

import java.sql.Timestamp;

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

public class Main {
    public static Timestamp addMinutes(Date date, int amount) {
        return add(date, Calendar.MINUTE, amount);
    }// ww  w  .j a v a2s . c  o m

    public static Timestamp add(Date date, int calendarField, int amount) {
        if (date == null) {
            throw new IllegalArgumentException("The date must not be null");
        }
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.add(calendarField, amount);
        return new Timestamp(c.getTimeInMillis());
    }
}

Related

  1. addHours(Date date, int amount)
  2. addHoursToDate(Date date, int hoursToBeAdded)
  3. addMilliseconds(Date date, int amount)
  4. addMilliseconds(Date date, int amount)
  5. addMinuteToDate(Date date, int minutesToBeAdded)
  6. addMinutes(Date date, int amount)
  7. addMonths(Date date, int amount)
  8. addMonths(Date date, int amount)
  9. addMonthsToDate(Date date, int monthsToBeAdded)