On this page:
leap-year?
days-in-year
days-in-month
day-of-month/  c
iso-weeks-in-year
7.7

17 Calendar Query Functions

procedure

(leap-year? y)  boolean?

  y : exact-integer?
Returns #t if y is a leap year, #f otherwise.

Examples:
> (leap-year? 1900)

#f

> (leap-year? 2000)

#t

> (leap-year? 2004)

#t

procedure

(days-in-year y)  (or/c 365 366)

  y : exact-integer?
Returns the number of days in year y.

Equivalent to: (if (leap-year? y) 366 365)

Examples:
> (days-in-year 1900)

365

> (days-in-year 2000)

366

> (days-in-year 2004)

366

procedure

(days-in-month y m)  (integer-in 28 31)

  y : exact-integer?
  m : (integer-in 1 12)
Returns the number of days in month m in year y.

Examples:
> (days-in-month 2015 8)

31

> (days-in-month 2015 2)

28

> (days-in-month 2016 2)

29

procedure

(day-of-month/c y m)  flat-contract?

  y : exact-integer?
  m : (integer-in 1 12)
Returns a contract for days in the specified month. The contract is equivalent to (integer-in 1 (days-in-month y m)).

procedure

(iso-weeks-in-year y)  (or/c 52 53)

  y : exact-integer?
Returns the number of weeks in year y, according to the ISO 8601 week-numbering year.

Examples:
> (iso-weeks-in-year 2005)

52

> (iso-weeks-in-year 2015)

53