UKismetTextLibrary::AsTimeZoneDate_DateTime
#include "Kismet/KismetTextLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Converts a date & time to text formatted as a date 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 an already-local value here will double-convert and produce the wrong date, especially near midnight in timezones far from UTC.
- • DST transitions mean the same UTC instant can format to a different local date depending on the exact time of year, which can be surprising for date-only displays near a DST boundary.
- • An invalid or unrecognized InTimeZone string falls back to interpreting the value in an implementation-defined way rather than raising a Blueprint-visible error.
Signature
static FText AsTimeZoneDate_DateTime(const FDateTime& InDateTime, const FString& InTimeZone = TEXT(""), TEnumAsByte<EDateTimeStyle::Type> InDateStyle = 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: Default, Short, Medium, Long, or Full. | EDateTimeStyle::Default |
Return Type
FText Example
Show a UTC timestamp as a local date C++
FDateTime UtcTimestamp = FDateTime::UtcNow();
FText LocalDateText = UKismetTextLibrary::AsTimeZoneDate_DateTime(UtcTimestamp, TEXT(""), EDateTimeStyle::Medium); Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?