Here you can find the source of getDateRelativeToNow(TimeUnit timeUnit, long amount)
public static Date getDateRelativeToNow(TimeUnit timeUnit, long amount)
//package com.java2s; import java.util.Date; import java.util.concurrent.TimeUnit; public class Main { /**//www .java 2 s. c om * Builds and returns a date that is a specified amount of time away from now (earlier or later). */ public static Date getDateRelativeToNow(TimeUnit timeUnit, long amount) { return new Date(System.currentTimeMillis() + timeUnit.toMillis(amount)); } }