Here you can find the source of durationFromNow(TemporalAmount duration)
public static long durationFromNow(TemporalAmount duration)
//package com.java2s; //License from project: Open Source License import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.temporal.TemporalAmount; public class Main { public static long durationFromNow(TemporalAmount duration) { return LocalDateTime.now(ZoneId.of("UTC")).plus(duration).toEpochSecond(ZoneOffset.UTC); }//from w ww. j av a2s . c om }