Here you can find the source of difference(ZonedDateTime t1, ZonedDateTime t2)
public static long difference(ZonedDateTime t1, ZonedDateTime t2)
//package com.java2s; //License from project: Apache License import java.time.ZonedDateTime; public class Main { public static long difference(ZonedDateTime t1, ZonedDateTime t2) { return t2.toInstant().toEpochMilli() - t1.toInstant().toEpochMilli(); }/*from w w w.ja v a 2 s . c om*/ }