Java Date Equal isEqualByDay(Date date1, Date date2)

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

Description

is Equal By Day

License

Open Source License

Declaration

public static boolean isEqualByDay(Date date1, Date date2) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {

    public static boolean isEqualByDay(Date date1, Date date2) {
        Calendar cal1 = Calendar.getInstance();
        cal1.setTime(date1);/*from www.j ava  2 s .c o  m*/
        Calendar cal2 = Calendar.getInstance();
        cal2.setTime(date2);
        return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)
                && cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR);
    }
}

Related

  1. equalsToDate(Date date1, Date date2, boolean checkTime)
  2. equalsWoTime(final Date date1, final Date date2)
  3. firstLessOrEqualSecond(Date firstDate, Date secondDate)
  4. hourEqual(Date date1, Date date2)
  5. isEqual(Date date1, Date date2)
  6. isEqualDate(Date date1, Date date2)
  7. isEqualField(int field, Date d1, Date d2)
  8. isLowerEqualDate(Date date)
  9. isSameDate(Date date, Date date1)