Java Minute Calculate plusMinute(Date date, int minutes)

Here you can find the source of plusMinute(Date date, int minutes)

Description

plus Minute

License

Open Source License

Declaration

public static Date plusMinute(Date date, int minutes) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static Date plusMinute(Date date, int minutes) {
        if (date == null)
            date = getToday();//from w  ww. j av a2s  .c  o m
        return changeMinute(date, minutes);
    }

    public static Date getToday() {
        return new Date();
    }

    private static Date changeMinute(Date date, int minutes) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.add(Calendar.MINUTE, minutes);
        return cal.getTime();
    }

    public static String getTime() {
        return sdfTime.format(new Date());
    }
}

Related

  1. getTravelTimeinMinutes(String startTime, String endTime)
  2. minusMinutes(String s, long minutes)
  3. minuteBetween(Date smdate, Date bdate)
  4. minutesBetween(String from, String to, String format)
  5. minutesToHylaTime(int mins)
  6. plusMinute(int minute)
  7. setMinutes(Date date, int amount)
  8. shiftTime(Object o, int minutes)
  9. toDegreesMinutes(double degrees, int nDecimals, boolean longitude)