RealDocs

UKismetMathLibrary::GetDays

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

Description

Returns the days component of the timespan as an integer. This is the whole-day portion only, not the total number of days represented.

Caveats & Gotchas

  • This returns the days *component*, not total days — a timespan of 1 day 6 hours returns 1, not 1.25. Use GetTotalDays() for the floating-point total.
  • For negative timespans the returned value is negative or zero, matching FTimespan's signed internal representation.

Signature

static UE_INL_API int32 GetDays( FTimespan A );

Parameters

Name Type Description Default
A FTimespan The timespan to query.

Return Type

int32

Example

Display a session duration in days and hours C++
FTimespan Session = FTimespan::FromHours(50.0);
int32 Days  = UKismetMathLibrary::GetDays(Session);  // 2
int32 Hours = UKismetMathLibrary::GetHours(Session); // 2
FString Label = FString::Printf(TEXT("%d days %d hours"), Days, Hours);

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.