RealDocs

UKismetMathLibrary::FromUnixTimestamp

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

Description

Converts a Unix timestamp (seconds since 1970-01-01 00:00:00 UTC) into an FDateTime. The resulting value represents UTC time.

Caveats & Gotchas

  • The returned FDateTime is in UTC — if you display it to the user you will need to apply a local time offset manually, as FDateTime has no time zone metadata.
  • Negative Unix timestamps (dates before 1970) may be passed but the result must still fall within FDateTime's valid range (year 1–9999). There is no overflow check in Shipping builds.

Signature

static UE_INL_API FDateTime FromUnixTimestamp(const int64 UnixTime);

Parameters

Name Type Description Default
UnixTime const int64 Seconds since the Unix Epoch (1970-01-01 00:00:00 UTC).

Return Type

FDateTime

Example

Convert a server timestamp to FDateTime C++
int64 ServerTimestamp = GetServerTimestamp(); // seconds since epoch from your backend
FDateTime EventTime = UKismetMathLibrary::FromUnixTimestamp(ServerTimestamp);
UE_LOG(LogTemp, Log, TEXT("Event time (UTC): %s"), *EventTime.ToString());

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.