RealDocs

UKismetMathLibrary::IsLeapYear

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Returns true if the given year is a leap year under the proleptic Gregorian calendar rules (divisible by 4, except centuries unless also divisible by 400).

Caveats & Gotchas

  • Year 1900 returns false (not a leap year — divisible by 100 but not 400). Year 2000 returns true. These are common off-by-one mistakes when porting Julian-calendar logic.
  • The function does not validate the year range — passing Year=0 or negative values produces an incorrect answer silently in Shipping.

Signature

static UE_INL_API bool IsLeapYear( int32 Year );

Parameters

Name Type Description Default
Year int32 The year to test (1–9999).

Return Type

bool

Example

Display leap year status C++
int32 Year = FDateTime::Now().GetYear();
bool bLeap = UKismetMathLibrary::IsLeapYear(Year);
UE_LOG(LogTemp, Log, TEXT("%d is%s a leap year"), Year, bLeap ? TEXT("") : TEXT(" not"));

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.