UKismetMathLibrary::GetYear
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns the year component of an FDateTime value as an integer. Equivalent to calling A.GetYear() directly on the struct.
Caveats & Gotchas
- • The year is in the proleptic Gregorian calendar — years before 1582 are valid but may not match historical calendar systems used at that time.
- • FDateTime stores time internally as ticks (100-nanosecond intervals since Jan 1, 0001), so the year range is 1 to 9999. Values outside this range cannot be represented.
Signature
static UE_INL_API int32 GetYear( FDateTime A ); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FDateTime | The DateTime value to extract the year from. | — |
Return Type
int32 Example
Extract year from current local time C++
FDateTime Now = FDateTime::Now();
int32 Year = UKismetMathLibrary::GetYear(Now);
UE_LOG(LogTemp, Log, TEXT("Current year: %d"), Year); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?