RealDocs

UKismetMathLibrary::BreakDateTime

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

Description

Decomposes an FDateTime into its year, month, day, hour, minute, second, and millisecond components. The Blueprint NativeBreakFunc for DateTime — use this to display or format timestamps.

Caveats & Gotchas

  • All output values reflect UTC/absolute time — if your game logic stores local time you must apply the timezone offset yourself before calling BreakDateTime.
  • In C++ it is usually more efficient to call individual FDateTime accessors (GetYear(), GetMonth(), etc.) directly rather than destructuring all seven components when you only need one.

Signature

static ENGINE_API void BreakDateTime(FDateTime InDateTime, int32& Year, int32& Month, int32& Day, int32& Hour, int32& Minute, int32& Second, int32& Millisecond);

Parameters

Name Type Description Default
InDateTime FDateTime DateTime struct to decompose.
Year int32& Output: four-digit year.
Month int32& Output: month in [1,12].
Day int32& Output: day of month in [1,31].
Hour int32& Output: hour in [0,23].
Minute int32& Output: minute in [0,59].
Second int32& Output: second in [0,59].
Millisecond int32& Output: millisecond in [0,999].

Return Type

void

Example

Format a timestamp for display C++
FDateTime Now = FDateTime::UtcNow();
int32 Year, Month, Day, Hour, Minute, Second, Ms;
UKismetMathLibrary::BreakDateTime(Now, Year, Month, Day, Hour, Minute, Second, Ms);
FString Display = FString::Printf(TEXT("%04d-%02d-%02d %02d:%02d:%02d"),
    Year, Month, Day, Hour, Minute, Second);

Tags

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.