Java Date Compare by Day sameDay(int firstDate, int secondDate)

Here you can find the source of sameDay(int firstDate, int secondDate)

Description

same Day

License

Open Source License

Declaration

public static boolean sameDay(int firstDate, int secondDate) 

Method Source Code

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

import java.util.Calendar;

public class Main {
    public static boolean sameDay(int firstDate, int secondDate) {
        Calendar c1 = Calendar.getInstance();
        Calendar c2 = Calendar.getInstance();
        c1.setTimeInMillis(firstDate * 1000L);
        c2.setTimeInMillis(secondDate * 1000L);
        return (c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR))
                && (c1.get(Calendar.DAY_OF_YEAR) == c2.get(Calendar.DAY_OF_YEAR));
    }//from   w  w w  .j  a  v a  2  s. c  om
}

Related

  1. sameDay(Date date1, Date date2)
  2. sameDay(Date date1, Date date2)
  3. sameDay(Date dateOne, Date dateTwo)
  4. sameDay(Date t1, Date t2)
  5. sameDay(Date t1, Date t2, TimeZone tz)