OpenBI Docs Buy

Date.IsLeapYear

Whether the year of a date has 366 days.

Group: Dates and times. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Date.IsLeapYear(dateTime as any) as nullable logical
ParameterTypeDescription
dateTimeanyA date, datetime or datetimezone value; null gives null.

Returns

nullable logical. true for a leap year, false otherwise.

Remarks

  • A year divisible by 4 is a leap year, except whole centuries, of which only those divisible by 400 are: 2000 was one, 2100 is not.

Examples

2024

Date.IsLeapYear(#date(2024, 6, 1))
true

Three years checked

List.Transform({2023, 2024, 2100}, each Date.IsLeapYear(#date(_, 1, 1)))
{false, true, false}

Date.DaysInMonth, Date.DayOfYear, Date.Year.

Last updated · OpenBI Studio 0.3.79