Java Date Compare compareDate(Date d1, Date d2)

Here you can find the source of compareDate(Date d1, Date d2)

Description

compare Date

License

Apache License

Declaration

public static boolean compareDate(Date d1, Date d2) 

Method Source Code

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

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

public class Main {

    public static boolean compareDate(Date d1, Date d2) {
        Calendar c1 = Calendar.getInstance();
        Calendar c2 = Calendar.getInstance();
        c1.setTime(d1);/*  w  ww.java  2s  . co m*/
        c2.setTime(d2);

        int result = c1.compareTo(c2);
        if (result > 0)
            return true;
        else
            return false;
    }
}

Related

  1. compare2DateString(String DateStringType, String dateStr1, String dateStr2)
  2. compare_date2(String finalDate, String enddate)
  3. compareCalendars(Date fechaAComparar, Date fechaBase)
  4. compareDate(Date d1, Date d2)
  5. compareDate(Date d1, Date d2)
  6. CompareDate(Date date, Date otherdate)
  7. compareDate(Date date1)
  8. compareDate(Date date1, Date date2)
  9. compareDate(Date DATE1, Date DATE2)