Java ZonedDateTime Calculate diffMs(ZonedDateTime date1, ZonedDateTime date2)

Here you can find the source of diffMs(ZonedDateTime date1, ZonedDateTime date2)

Description

Finds the difference (in ms) between two LocalDateTime.

License

Open Source License

Parameter

Parameter Description
date1 a parameter
date2 a parameter

Return

time difference in ms

Declaration

public static long diffMs(ZonedDateTime date1, ZonedDateTime date2) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.time.Duration;
import java.time.ZonedDateTime;

public class Main {
    /**//from   ww w . ja va  2 s. c om
     * Finds the difference (in ms) between two LocalDateTime. Returns date2 - date1.
     * 
     * @param date1
     * @param date2
     * @return time difference in ms
     */
    public static long diffMs(ZonedDateTime date1, ZonedDateTime date2) {
        return Duration.between(date1, date2).getSeconds() * 1000;
    }
}

Related

  1. computeDays(ZonedDateTime Start, ZonedDateTime End)
  2. convertDateToZonedDateTime(Date date, String timezone)
  3. convertForPersistence(@Nullable ZonedDateTime dt)
  4. currentZonedDateTime()
  5. difference(ZonedDateTime t1, ZonedDateTime t2)
  6. elapsedTime(ZonedDateTime zonedDateTime)
  7. equals(ZonedDateTime ZDT1, ZonedDateTime ZDT2)
  8. filter(final Set list, final ZonedDateTime base, final long minute)
  9. findIdx(int startidx, int endidx, ZonedDateTime endDate, List holidays)