RealDocs

UKismetTextLibrary::AsTimeZoneTime_DateTime

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

Description

Converts a date & time to text formatted as a time only, 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 — passing a value that's already local time will shift it again and produce an incorrect displayed time.
  • A time-only display near a DST transition or a timezone crossing midnight can show a time that appears to belong to the wrong day, since only the time component is rendered.

Signature

static FText AsTimeZoneTime_DateTime(const FDateTime& InDateTime, const FString& InTimeZone = TEXT(""), 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("")
InTimeStyle TEnumAsByte<EDateTimeStyle::Type> Formatting style: Default, Short, Medium, Long, or Full. EDateTimeStyle::Default

Return Type

FText

Example

Show a UTC timestamp's time-of-day locally C++
FDateTime UtcTimestamp = FDateTime::UtcNow();
FText LocalTimeText = UKismetTextLibrary::AsTimeZoneTime_DateTime(UtcTimestamp, TEXT(""), 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.