Java ZonedDateTime Calculate elapsedTime(ZonedDateTime zonedDateTime)

Here you can find the source of elapsedTime(ZonedDateTime zonedDateTime)

Description

elapsed Time

License

Apache License

Declaration

public static Long elapsedTime(ZonedDateTime zonedDateTime) 

Method Source Code

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

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class Main {
    public static Long elapsedTime(ZonedDateTime zonedDateTime) {
        return difference(zonedDateTime, ZonedDateTime.now());
    }// ww w . j  av a 2  s  .c o m

    public static long difference(ZonedDateTime t1, ZonedDateTime t2) {
        return t2.toInstant().toEpochMilli() - t1.toInstant().toEpochMilli();
    }

    public static String now() {
        return ZonedDateTime.now().format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
    }
}

Related

  1. convertDateToZonedDateTime(Date date, String timezone)
  2. convertForPersistence(@Nullable ZonedDateTime dt)
  3. currentZonedDateTime()
  4. difference(ZonedDateTime t1, ZonedDateTime t2)
  5. diffMs(ZonedDateTime date1, ZonedDateTime date2)
  6. equals(ZonedDateTime ZDT1, ZonedDateTime ZDT2)
  7. filter(final Set list, final ZonedDateTime base, final long minute)
  8. findIdx(int startidx, int endidx, ZonedDateTime endDate, List holidays)
  9. getDuration(ZonedDateTime input, TemporalField roundTo, int roundIncrement)