Java Day Between getDiffMilliSeconds(Date form, Date to)

Here you can find the source of getDiffMilliSeconds(Date form, Date to)

Description

get Diff Milli Seconds

License

Open Source License

Declaration

public static long getDiffMilliSeconds(Date form, Date to) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static long getDiffMilliSeconds(Date form, Date to) {
        Calendar cal1 = new GregorianCalendar();
        cal1.setTime(form);/*from   w  w  w. ja v  a2 s.c o  m*/
        Calendar cal2 = new GregorianCalendar();
        cal2.setTime(to);
        return (cal1.getTimeInMillis() - cal2.getTimeInMillis());
    }
}

Related

  1. getDifferDays(String date1, String date2)
  2. getDifference(Date d1, Date d2)
  3. getDifferenceInDays(final Date startDate, final Date endDate)
  4. getDifferenceOfDays(String dateFromStr, String dateToStr, String dateFormat)
  5. getDifferencesBetweenIndicateDays( final Date minorDate, final Date majorDate)
  6. getManyWeeksDifference(Date a, Date b)
  7. getMinuteDiffByTime(Date time1, Date time2)
  8. getMinutesDifference(final Date begin, final Date end)
  9. getMonthDifference(Date from, Date to)