Java Milliseconds millisBetween(Date firstDate, Date lastDate)

Here you can find the source of millisBetween(Date firstDate, Date lastDate)

Description

Retorna o número de milissegundos entre dias dadas

License

Apache License

Parameter

Parameter Description
firstDate Data inicial
lastDate Data final

Return

Número de milissegundos

Declaration

public static long millisBetween(Date firstDate, Date lastDate) 

Method Source Code

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

import java.util.*;

public class Main {
    /**/*  w  ww  . j a v  a 2  s.c om*/
     * Retorna o número de milissegundos entre dias dadas
     * @param firstDate Data inicial
     * @param lastDate Data final
     * @return Número de milissegundos
     */
    public static long millisBetween(Date firstDate, Date lastDate) {
        long t1 = firstDate.getTime();
        long t2 = lastDate.getTime();
        long dif = t1 - t2;

        if (dif < 0) {
            dif = dif * (-1);
        }
        return dif;
    }
}

Related

  1. marsTimeFromElapsedMillis(long elapsedMillis, int[] marsTime)
  2. megaCyclesToMilliseconds(long megaCycles)
  3. microsToMillis(long micros)
  4. microsToMillis(long sec, long usec)
  5. milliDate(String date)
  6. millisecond(final Date date)
  7. millisecondOf(Date date)
  8. milliseconds(int offset)
  9. millisecondsBetween(Date start, Date finish)