Code Library

DAX · UDF

Date.IsLeapYear

Indica se o ano é bissexto no calendário gregoriano.

Categoria: Data e horaTipo: UDFVersão: v1.1.0Fonte: Paulo André Jesus — OfficeTuningAtualizado em: 25/09/2026
Documentação completa na Function Library →

Sintaxe

Date.IsLeapYear ( pYearNumber )

Argumentos

NomeTipoObrigatórioDescrição
pYearNumberINT64 VALSimAno.

Retorno

Verdadeiro/falso

Código completo

DEFINE
    /// Indica se o ano é bissexto no calendário gregoriano.
    /// @param {INT64} pYearNumber - Ano.
    /// @returns TRUE se o ano for bissexto.
    FUNCTION Date.IsLeapYear =
        ( pYearNumber : INT64 VAL ) =>
        MOD ( pYearNumber, 400 ) = 0
            || ( MOD ( pYearNumber, 4 ) = 0 && MOD ( pYearNumber, 100 ) <> 0 )

EVALUATE
{ Date.IsLeapYear ( 2028 ), Date.IsLeapYear ( 1900 ), Date.IsLeapYear ( 2000 ) }  // TRUE · FALSE · TRUE

Exemplos

EVALUATE { Date.IsLeapYear ( 2028 ), Date.IsLeapYear ( 1900 ), Date.IsLeapYear ( 2000 ) }
// TRUE · FALSE · TRUE

Dicas e observações

💡 Divisível por 4, exceto séculos; séculos só se divisíveis por 400.