Java Milliseconds getElapsedTimeInMilliseconds(Date startDate, Date endDate)

Here you can find the source of getElapsedTimeInMilliseconds(Date startDate, Date endDate)

Description

Return the elapsed time between the start date and now.

License

Open Source License

Parameter

Parameter Description
startDate The initial start date.

Return

Elapsed time between the start date and now.

Declaration

public static long getElapsedTimeInMilliseconds(Date startDate, Date endDate) 

Method Source Code


//package com.java2s;

import java.util.*;

public class Main {
    /**/*  w ww . j  a  va2  s . c  o m*/
     * Return the elapsed time between the start date and now.  Returns a String
     * representation in HH:MM:SS format.
     * @param startDate  The initial start date.
     * @return           Elapsed time between the start date and now.
     */
    public static long getElapsedTimeInMilliseconds(Date startDate, Date endDate) {
        // Convert to milliseconds.
        long startMilliseconds = startDate.getTime();
        long endMilliseconds = endDate.getTime();
        return endMilliseconds - startMilliseconds;
    }
}

Related

  1. formatDateMillis(long millis)
  2. FormatDateTime(Calendar p_date, String p_seperator, boolean p_showMilliseconds)
  3. fractionOfDayToMilliseconds(float fFractionOfDay)
  4. getDurationFromMillis(final long millis)
  5. getDurationSecFromMillisDouble(long millis)
  6. getExpirationInMilliSeconds(long currentTime, int expirationTime)
  7. getExpirationMillisAbs(int recordExpirationTimestamp)
  8. getFullSecondsElapsedTimeMillis(long start, long end)
  9. getLogTimeFromMillis(Long millis)