RealDocs

UKismetMathLibrary::GetDay

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

Description

Returns the day-of-month component of A as an integer in the range 1–31. Use this when you need to display or compare individual date components.

Caveats & Gotchas

  • The return value is 1-based (1 = first day of the month), not 0-based. Subtracting 1 before indexing an array is a common off-by-one mistake.
  • The valid range depends on the month and year — February in a non-leap year has a maximum of 28. If A was constructed with an out-of-range day, FDateTime clamps or wraps the value; the returned day may not match what you passed to the constructor.

Signature

static UE_INL_API int32 GetDay( FDateTime A );

Parameters

Name Type Description Default
A FDateTime The date-time to extract the day from.

Return Type

int32

Example

Display a date string C++
FDateTime Now = FDateTime::UtcNow();
int32 Day   = UKismetMathLibrary::GetDay(Now);
int32 Month = UKismetMathLibrary::GetMonth(Now);
int32 Year  = UKismetMathLibrary::GetYear(Now);
FString DateStr = FString::Printf(TEXT("%04d-%02d-%02d"), Year, Month, Day);

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.