RealDocs

UKismetMathLibrary::GetDate

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

Description

Returns a new FDateTime containing only the date portion of A, with the time-of-day set to midnight (00:00:00.000). Use this to normalize timestamps for day-level comparisons.

Caveats & Gotchas

  • The returned FDateTime has a time component of exactly zero ticks past midnight. Comparing two date-only values with EqualEqual_DateTimeDateTime will work correctly, but comparing a date-only value against a full timestamp will fail unless you also strip the time from the other operand.
  • Because FDateTime has no timezone concept, 'midnight' here means the same reference frame as the input — if A is a local-time timestamp, the result is local midnight; if A is UTC, the result is UTC midnight.

Signature

static UE_INL_API FDateTime GetDate( FDateTime A );

Parameters

Name Type Description Default
A FDateTime The date-time to extract the date from.

Return Type

FDateTime

Example

Check if two events fall on the same day C++
FDateTime EventA = GetEventTime();
FDateTime EventB = GetOtherEventTime();
bool bSameDay = UKismetMathLibrary::EqualEqual_DateTimeDateTime(
    UKismetMathLibrary::GetDate(EventA),
    UKismetMathLibrary::GetDate(EventB)
);

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.