Java Millisecond Convert getDurationMillisecond(Date date1, Date date2)

Here you can find the source of getDurationMillisecond(Date date1, Date date2)

Description

get Duration Millisecond

License

Open Source License

Declaration

public static long getDurationMillisecond(Date date1, Date date2) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class Main {
    private static final String TIME_FORMAT = "HH:mm:ss";
    private static SimpleDateFormat sFormat;

    public static long getDurationMillisecond(Date date1, Date date2) {
        return date2.getTime() - date1.getTime();
    }// w w  w . j  a  va2s.c o m

    public static String getTime(Date date) {
        sFormat = new SimpleDateFormat(TIME_FORMAT, Locale.CHINA);
        return sFormat.format(date);
    }

    public static String getTime() {
        return getTime(new Date());
    }
}

Related

  1. convertToMillis(float timeInSeconds)
  2. convertToMillis(String time)
  3. convertToMilliseconds(String value)
  4. getDuration(final long millis)
  5. getDurationBreakdown(long durationInMillis)
  6. getHumanDisplayForTimediff(Long diffMillis)
  7. getNice(long timeMillisecGMT)
  8. getStringFromMillis(long timestamp)
  9. getTime(long millis)