UKismetMathLibrary::GetMonth
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the month component of A as an integer in the range 1–12, where 1 is January and 12 is December.
Caveats & Gotchas
- • The return value is 1-based. January returns 1, not 0. Arrays indexed by month (e.g. a 12-element array of month names) must subtract 1 to get the correct zero-based index.
- • This returns the Gregorian calendar month with no locale awareness. Games targeting regions that use non-Gregorian calendars for display purposes must convert separately.
Signature
static UE_INL_API int32 GetMonth( FDateTime A ); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FDateTime | The date-time to extract the month from. | — |
Return Type
int32 Example
Activate seasonal content C++
FDateTime Now = FDateTime::UtcNow();
int32 Month = UKismetMathLibrary::GetMonth(Now);
// December, January, February = winter
bool bWinter = (Month == 12 || Month == 1 || Month == 2);
if (bWinter) { ActivateWinterEvent(); } Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?