Java Date Compare compDate(Date date1, Date date2)

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

Description

comp Date

License

Apache License

Declaration

public static int compDate(Date date1, Date date2) 

Method Source Code

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

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

public class Main {
    public static int compDate(Date date1, Date date2) {
        Calendar ca1 = Calendar.getInstance();
        Calendar ca2 = Calendar.getInstance();
        ca1.setTime(date1);/*  w  w w .  ja  va2s .com*/
        ca2.setTime(date2);
        int distanceMin = ca1.get(Calendar.MINUTE) - ca2.get(Calendar.MINUTE);
        return distanceMin;
    }
}

Related

  1. compareToCal(Date sDate, Date eDate)
  2. compareToMonthByDate(Date startDate, Date endDate)
  3. compareTwoDate(Date beforeDate, Date afterDate)
  4. compareYear(java.util.Date date1, java.util.Date date2)
  5. compareYMD(Date begindate, Date enddate)
  6. compDate4(Date date1, Date date2)
  7. getCompareDate(Date startDate, Date endDate)
  8. getCompareDate(String strDate1, String strDate2, String pFormat)
  9. getCompareDate(String strDate1, String strDate2, String pFormat)