Java Calendar Day isSameDay(Calendar cal1, Calendar cal2)

Here you can find the source of isSameDay(Calendar cal1, Calendar cal2)

Description

is Same Day

License

Apache License

Declaration

public static boolean isSameDay(Calendar cal1, Calendar cal2) 

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 isSameDay(Date d1, Date d2) {
        Calendar c1 = Calendar.getInstance();
        c1.setTime(d1);// ww  w  .j ava  2s.com
        Calendar c2 = Calendar.getInstance();
        c2.setTime(d2);
        return isSameDay(c1, c2);
    }

    public static boolean isSameDay(Calendar cal1, Calendar cal2) {
        return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)
                && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH)
                && cal1.get(Calendar.DAY_OF_MONTH) == cal2.get(Calendar.DAY_OF_MONTH);
    }
}

Related

  1. isRestDay(Calendar cal)
  2. isSameDay(Calendar c1, Calendar c2)
  3. isSameDay(Calendar cal1, Calendar cal2)
  4. isSameDay(Calendar cal1, Calendar cal2)
  5. isSameDay(Calendar cal1, Calendar cal2)
  6. isSameDay(Calendar cal1, Calendar cal2)
  7. isSameDay(Calendar cal1, Calendar cal2)
  8. isSameDay(Calendar cal1, Calendar cal2)
  9. isSameDay(Calendar day1, Calendar day2)