Java Minute nextMinutes(int diff)

Here you can find the source of nextMinutes(int diff)

Description

next Minutes

License

Apache License

Declaration

public static Date nextMinutes(int diff) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {

    public static Date nextMinutes(int diff) {
        return add(new Date(), Calendar.MINUTE, diff);
    }/*w  w  w. jav a2 s  .  c  o m*/

    public static Date nextMinutes(Date date, int diff) {
        return add(date, Calendar.MINUTE, diff);
    }

    /**
     * @since 2008-01-02
     */
    public static Date add(Date date, int field, int diff) {
        Calendar c = getCalendar(date);
        c.add(field, diff);
        return c.getTime();
    }

    /**
     * @since 2008-01-02
     */
    public static Date add(int field, int diff) {
        return add(new Date(), field, diff);
    }

    /**
     * @since 2008-01-02
     */
    public static Calendar getCalendar(long millis) {
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(millis);
        return c;
    }

    /**
     * @since 2008-01-02
     */
    public static Calendar getCalendar(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        return c;
    }
}

Related

  1. minutes2seconds(long minutes)
  2. minutesFromEpisode(int episodeNumber, int episodeLength)
  3. minutesFromSecondPadded(int seconds)
  4. minutesFromSlots(int slots)
  5. mjdInMinutes(double mjd)
  6. normalizeToMinute(Date date)
  7. numberOfMinutesForDays(int days)
  8. refineHourMinute(String timeString)
  9. samplesToMinutes(int sampleRate, int samples)