Java Date Compare compare(Date d1, Date d2)

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

Description

compare

License

Apache License

Declaration

public static Integer compare(Date d1, Date d2) 

Method Source Code

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

import java.util.*;

public class Main {

    public static Integer compare(Date d1, Date d2) {
        java.util.Calendar c1 = java.util.Calendar.getInstance();
        java.util.Calendar c2 = java.util.Calendar.getInstance();
        c1.setTime(d1);//from w  ww.j a  va2  s  .  c  o m
        c2.setTime(d2);
        return c1.compareTo(c2);
    }
}

Related

  1. after(String format, String baseDate, String compareDate)
  2. compare(Date d1, Date d2)
  3. compare(Date d1, Date d2)
  4. compare(Date date, Date fromDate, Date toDate)
  5. compare(Date date1, Date date2, String format)