UKismetMathLibrary::MakeDateTime
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Constructs an FDateTime from individual calendar and time components. The Blueprint NativeMakeFunc for the DateTime struct — used whenever you need to create a specific timestamp.
Caveats & Gotchas
- • No validation or clamping — passing Month=13 or Day=32 will produce an incorrect FDateTime without an error or assertion in shipping builds. Validate inputs before calling.
- • The resulting FDateTime is not timezone-aware; UE's FDateTime is always UTC/absolute ticks. Do not assume it represents local time unless you explicitly offset it.
Signature
static ENGINE_API FDateTime MakeDateTime(int32 Year, int32 Month, int32 Day, int32 Hour = 0, int32 Minute = 0, int32 Second = 0, int32 Millisecond = 0); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Year | int32 | Four-digit year (e.g. 2025). | — |
| Month | int32 | Month in [1,12]. | — |
| Day | int32 | Day of month in [1,31]. | — |
| Hour | int32 | Hour in [0,23]. | 0 |
| Minute | int32 | Minute in [0,59]. | 0 |
| Second | int32 | Second in [0,59]. | 0 |
| Millisecond | int32 | Millisecond in [0,999]. | 0 |
Return Type
FDateTime Example
Create a specific event timestamp C++
FDateTime EventTime = UKismetMathLibrary::MakeDateTime(2025, 12, 31, 23, 59, 59, 0);
FTimespan TimeUntil = EventTime - FDateTime::UtcNow();
UE_LOG(LogTemp, Log, TEXT("Seconds until event: %lld"), TimeUntil.GetTotalSeconds()); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?