Java TimeUnit Calculate getComingTime(Integer delta, TimeUnit unit)

Here you can find the source of getComingTime(Integer delta, TimeUnit unit)

Description

get Coming Time

License

Open Source License

Declaration

public static Date getComingTime(Integer delta, TimeUnit unit) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit;

public class Main {
    public static Date getComingTime(Integer delta, TimeUnit unit) {
        Calendar cal = Calendar.getInstance();

        long base = cal.getTimeInMillis();
        long d = unit.toMillis(delta);

        cal.setTimeInMillis(base + d);//  w w w . j  av a 2 s. c  o  m

        return cal.getTime();
    }
}

Related

  1. delayQuietly(final long time, final TimeUnit unit)
  2. diff(Date earlier, Date later, TimeUnit timeUnit)
  3. differenceBetween(Date initDate, Date endDate, TimeUnit units)
  4. getBase(final TimeUnit unit)
  5. getBucketInMillis(int bucketSize, TimeUnit bucketUnit)
  6. getDate(final TimeUnit unit, final int offset)
  7. getDateDiff(Date date1, Date date2, TimeUnit timeUnit)
  8. getDateDiff(final Date d1, final Date d2, final TimeUnit timeUnit)
  9. getDifference(Calendar initDate, Calendar endDate, TimeUnit units)