Java TimeUnit Calculate dateIn(long distance, TimeUnit unit)

Here you can find the source of dateIn(long distance, TimeUnit unit)

Description

date In

License

Apache License

Declaration

public static Date dateIn(long distance, TimeUnit unit) 

Method Source Code

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

import java.util.Date;

import java.util.concurrent.TimeUnit;

public class Main {
    public static Date dateIn(long distance, TimeUnit unit) {
        Date now = new Date();
        return new Date(now.getTime() + unit.toMillis(distance));
    }/*w w w . ja v a 2 s . c  o m*/
}

Related

  1. calculateTimeout(long timeout, TimeUnit timeUnit)
  2. checkTime(long time, TimeUnit timeunit)
  3. checkTimeUnit(TimeUnit timeUnit)
  4. createEquidistantDates(Calendar reference, final int periods, final TimeUnit sampleUnit, final int sampleRate, Calendar calendar)
  5. dateDifference(Date date1, Date date2, TimeUnit timeUnit)
  6. deepSleep(long sleepFor, TimeUnit unit)
  7. delayQuietly(final long time, final TimeUnit unit)
  8. diff(Date earlier, Date later, TimeUnit timeUnit)
  9. differenceBetween(Date initDate, Date endDate, TimeUnit units)