Java Date Compare by Day sameDay(Date date1, Date date2)

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

Description

same Day

License

Apache License

Declaration

public static boolean sameDay(Date date1, Date date2) 

Method Source Code

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

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

public class Main {
    public static boolean sameDay(Date date1, Date date2) {
        Calendar c1 = new GregorianCalendar();
        Calendar c2 = new GregorianCalendar();
        c1.setTime(date1);//from  w w w. j a  v a 2s . c o  m
        c2.setTime(date2);
        return c1.get(Calendar.DAY_OF_YEAR) == c2.get(Calendar.DAY_OF_YEAR);
    }
}

Related

  1. isSameDay(final Date date1, final Date date2)
  2. isSameDayWithToday(Date date)
  3. sameDay(Date date1, Date date2)
  4. sameDay(Date date1, Date date2)
  5. sameDay(Date date1, Date date2)
  6. sameDay(Date dateOne, Date dateTwo)
  7. sameDay(Date t1, Date t2)
  8. sameDay(Date t1, Date t2, TimeZone tz)
  9. sameDay(int firstDate, int secondDate)