Java Year IsInLeapYear(Date date1)

Here you can find the source of IsInLeapYear(Date date1)

Description

Indicates whether the year in the specified date is in a leap year.

License

Open Source License

Parameter

Parameter Description
date1 Date object

Return

Whether the year is in a leap year

Declaration

public static boolean IsInLeapYear(Date date1) 

Method Source Code

//package com.java2s;
// it under the terms of the GNU General Public License as published by

import java.util.*;

public class Main {
    /** Indicates whether the year in the specified date is in a leap year.
     *//from ww  w  .  ja  v  a2  s  .c  o  m
     * @param date1 Date object
     * @return Whether the year is in a leap year
     */
    public static boolean IsInLeapYear(Date date1) {
        GregorianCalendar cal = new GregorianCalendar();
        cal.setTime(date1);
        return cal.isLeapYear(cal.get(cal.YEAR));
    }
}

Related

  1. createCalendarAtBeginningOfYear(int year)
  2. currentYear()
  3. daysInYear(int year)
  4. differenceInYears(final Calendar a, final Calendar b)
  5. diffYears(Date day1, Date day2)
  6. isLeapYear(int year)
  7. nextYears(int diff)
  8. sameYear(Date date1, Date date2)
  9. yearAndSeason(Date date)