RealDocs

UKismetMathLibrary::GetTotalDays

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

Description

Returns the total number of days represented by the timespan as a double, including the fractional part. A timespan of 36 hours returns 1.5.

Caveats & Gotchas

  • The return type is double even though Blueprint uses float — when the result is consumed by Blueprint, precision is silently reduced to float, which loses sub-millisecond accuracy for very long timespans.
  • Contrast with GetDays(), which returns only the whole-day integer component — GetTotalDays() accumulates all sub-components into one floating-point value.

Signature

static UE_INL_API double GetTotalDays( FTimespan A );

Parameters

Name Type Description Default
A FTimespan The timespan to query.

Return Type

double

Example

Compute progress through a multi-day window C++
FTimespan Window    = FTimespan::FromDays(7.0);
FTimespan Elapsed   = FDateTime::UtcNow() - WindowStart;
double Progress     = UKismetMathLibrary::GetTotalDays(Elapsed) / 7.0;
Progress            = FMath::Clamp(Progress, 0.0, 1.0);

Version History

Introduced in: 4.7

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.