leap.year

0th

Percentile

Is a year a leap year?

Is a year a leap year?

Keywords
logic, chron
Usage
leap.year(date)
Arguments
date
a date-time object or a year
Details

If x is a recognized date-time object, leap.year will return whether x occurs during a leap year. If x is a number, leap.year returns whether it would be a leap year under the Gregorian calendar.

aliases leap.year leap_year leapyear

Value

  • TRUE if x is a leap year, FALSE otherwise

Aliases
  • leap.year
Examples
x <- as.Date("2009-08-02")
leap.year(x) # FALSE
leap.year(2009) # FALSE
leap.year(2008) # TRUE
leap.year(1900) # FALSE
leap.year(2000) # TRUE}
Documentation reproduced from package lubridate, version 0.1, License: GPL

Community examples

santjoke at Jul 29, 2019 lubridate v0.1

leap.year LEAP_YEAR_FORMULA <- function(a) { if ((a %% 400) == 0) { print("LEAP YEAR") } else if ((a %% 100) == 0 ) {print("NOT A LEAP YEAR") } else if ((a %% 4) == 0 ) {print("LEAP YEAR") } else {print("NOT A LEAP YEAR") } } LEAP_YEAR_FORMULA(1900) LEAP_YEAR_FORMULA(2000) LEAP_YEAR_FORMULA(1416)