Java Minute Get getMinuteAfter(Date date, int minute)

Here you can find the source of getMinuteAfter(Date date, int minute)

Description

get Minute After

License

Apache License

Declaration

public static String getMinuteAfter(Date date, int minute) 

Method Source Code


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

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

import java.text.SimpleDateFormat;

public class Main {
    public static final String dtLong = "yyyyMMddHHmmss";

    public static String getMinuteAfter(Date date, int minute) {
        Calendar now = Calendar.getInstance(Locale.CHINA);
        now.setTime(date);/*from   www  .  j  a  v a  2 s . c  om*/
        if (minute > 0) {
            now.set(Calendar.MINUTE, now.get(Calendar.MINUTE) + minute);
        }
        now.set(Calendar.MINUTE, now.get(Calendar.MINUTE));
        SimpleDateFormat format = new SimpleDateFormat(dtLong);
        return format.format(now.getTime());
    }
}

Related

  1. getMinute(Date date)
  2. getMinute(Date date1, Date date2)
  3. getMinute(long mills)
  4. getMinute(long time)
  5. getMinute(String time)
  6. getMinuteAsInt(String hourString)
  7. getMinuteCa(Date d1, Date d2)
  8. getMinuteDate(String date, String formatFormat)
  9. getMinuteFromHMS(String hms)