Java Date to Time getTimestampl(Date time1, Date time2)

Here you can find the source of getTimestampl(Date time1, Date time2)

Description

get Timestampl

License

Apache License

Declaration

public static long getTimestampl(Date time1, Date time2) 

Method Source Code

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

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static long getTimestampl(Date time1, Date time2) {
        if (time1 == null || time2 == null) {
            return 0;
        }/*  w  w w. j  a  va 2  s.  c  o  m*/
        Calendar cal = Calendar.getInstance();
        cal.setTime(time1);
        long m1 = cal.getTimeInMillis();
        cal.setTime(time2);
        long m2 = cal.getTimeInMillis();
        long between_sec = (m2 - m1);
        return between_sec;
    }
}

Related

  1. getTimerDate(String time)
  2. getTimeRoll(Date current, int field, int numberOfRoll)
  3. getTimeStamp(long timeMilis, boolean time, boolean date)
  4. getTimeStampInMin(Date date)
  5. getTimeStampInSec(char separator, Date date)
  6. getTimeStr(Date date, char delimiter)
  7. getTimeString(Date d)
  8. getTimeString(Date date)
  9. getTimeString(Date self)