Java Duration Calculate durationFromNow(TemporalAmount duration)

Here you can find the source of durationFromNow(TemporalAmount duration)

Description

duration From Now

License

Open Source License

Declaration

public static long durationFromNow(TemporalAmount duration) 

Method Source Code


//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
}

Related

  1. adjustServerTimeout(Duration clientTimeout)
  2. awaitTermination(ExecutorService service, Logger logger, Duration timeout, String technique)
  3. calculateDuration(Duration minimum, Duration maximum, Long iteration)
  4. daysRoundingUp(Duration duration)
  5. delayedFuture(Duration delay, ScheduledExecutorService executorService)
  6. failAfter(Duration duration)
  7. futureWithTimeout(Duration timeout, ScheduledExecutorService executorService)
  8. getDurationAsISO8601(Duration duration)
  9. getDurationByTimeValues(final long hours, final long minutes, final long seconds)