RealDocs

UKismetMathLibrary::DateTimeFromString

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

Description

Parses a date/time string in UE's native format (the format produced by FDateTime::ToString()) into an FDateTime. Returns true on success, false if parsing fails.

Caveats & Gotchas

  • This function expects UE's own ToString() format ('YYYY.MM.DD-HH.MM.SS'), not ISO-8601. Passing an ISO string will fail — use DateTimeFromIsoString() instead.
  • Like DateTimeFromIsoString, Result is not cleared on failure. Always validate the return value before using the output.

Signature

static UE_INL_API bool DateTimeFromString(FString DateTimeString, FDateTime& Result);

Parameters

Name Type Description Default
DateTimeString FString A date/time string in the format produced by FDateTime::ToString(), e.g. "2024.07.04-15.30.00".
Result FDateTime& Output FDateTime populated on success; unchanged on failure.

Return Type

bool

Example

Round-trip a DateTime through a string C++
FDateTime Original = FDateTime::Now();
FString Str = Original.ToString();

FDateTime Restored;
bool bOk = UKismetMathLibrary::DateTimeFromString(Str, Restored);
check(bOk && Restored == Original);

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.