Here you can find the source of elapsedTime(ZonedDateTime zonedDateTime)
public static Long elapsedTime(ZonedDateTime zonedDateTime)
//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); } }