Java Date Equal isSameDate(Date date, Date date1)

Here you can find the source of isSameDate(Date date, Date date1)

Description

is Same Date

License

Apache License

Declaration

public static boolean isSameDate(Date date, Date date1) 

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 isSameDate(Date date, Date date1) {
        return getDateField(date, Calendar.YEAR) == getDateField(date1, Calendar.YEAR)
                && getDateField(date, Calendar.MONTH) == getDateField(date1, Calendar.MONTH)
                && getDateField(date, Calendar.DATE) == getDateField(date1, Calendar.DATE);
    }/*  w ww  . jav a  2s.com*/

    public static int getDateField(Date date, int field) {
        Calendar ca = Calendar.getInstance();
        ca.setTime(date);
        return ca.get(field);
    }
}

Related

  1. isEqual(Date date1, Date date2)
  2. isEqualByDay(Date date1, Date date2)
  3. isEqualDate(Date date1, Date date2)
  4. isEqualField(int field, Date d1, Date d2)
  5. isLowerEqualDate(Date date)
  6. isSameDate(Date date1, Date date2)
  7. isSameDate(Date pathDate, Date now)
  8. isSameDate(long var0, long var2)
  9. monthEquals(Date current, Date compare)