RealDocs

UKismetTextLibrary::AsTimeZoneDateTime_DateTime

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

Description

Converts a date & time to combined date and time text, converting from UTC to the given timezone (or the local timezone if none is specified), accounting for daylight saving time.

Caveats & Gotchas

  • InDateTime is assumed to be UTC — this is the correct function to display a server-authoritative UTC timestamp (e.g. FDateTime::UtcNow()) in a player's local time.
  • DST transitions can make an ambiguous or non-existent local time near the transition boundary; the underlying ICU-based formatting resolves these per platform/locale rules rather than exposing the ambiguity to the caller.

Signature

static FText AsTimeZoneDateTime_DateTime(const FDateTime& InDateTime, const FString& InTimeZone = TEXT(""), TEnumAsByte<EDateTimeStyle::Type> InDateStyle = EDateTimeStyle::Default, TEnumAsByte<EDateTimeStyle::Type> InTimeStyle = EDateTimeStyle::Default);

Parameters

Name Type Description Default
InDateTime const FDateTime& The date and time to format, treated as UTC and converted to InTimeZone.
InTimeZone const FString& Target timezone identifier. Empty string uses the local timezone. TEXT("")
InDateStyle TEnumAsByte<EDateTimeStyle::Type> Formatting style for the date portion. EDateTimeStyle::Default
InTimeStyle TEnumAsByte<EDateTimeStyle::Type> Formatting style for the time portion. EDateTimeStyle::Default

Return Type

FText

Example

Show a server timestamp in a player's local timezone C++
FDateTime ServerTimeUtc = FDateTime::UtcNow();
FText LocalText = UKismetTextLibrary::AsTimeZoneDateTime_DateTime(ServerTimeUtc, TEXT(""), EDateTimeStyle::Medium, EDateTimeStyle::Short);

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.