Java Date Equal monthEquals(Date current, Date compare)

Here you can find the source of monthEquals(Date current, Date compare)

Description

month Equals

License

Apache License

Declaration

public static boolean monthEquals(Date current, Date compare) 

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 monthEquals(Date current, Date compare) {
        Calendar curr = Calendar.getInstance();
        curr.setTime(current);/*w  w w .jav  a2 s .co  m*/
        Calendar cmp = Calendar.getInstance();
        cmp.setTime(compare);
        int year1 = curr.get(1);
        int year2 = cmp.get(1);
        int month1 = curr.get(2);
        int month2 = cmp.get(2);
        return (year1 == year2) && (month1 == month2);
    }
}

Related

  1. isLowerEqualDate(Date date)
  2. isSameDate(Date date, Date date1)
  3. isSameDate(Date date1, Date date2)
  4. isSameDate(Date pathDate, Date now)
  5. isSameDate(long var0, long var2)
  6. nowInDateEquals(Date now, Date d1, Date d2)
  7. sameDate(Date date1, Date date2)
  8. sameDate(Date date1, Date date2)
  9. yearMonthsEqual(final Date firstDate, final Date secondDate)