RealDocs

UKismetMathLibrary::GetHours

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

Description

Returns the hours component of the timespan (the whole hours remaining after extracting full days). Range is -23 to +23.

Caveats & Gotchas

  • This is the hours *component*, not total hours — a 26-hour timespan returns 2 (not 26). For total hours use FTimespan::GetTotalHours() directly in C++.
  • For negative timespans the value will be in the range -23 to 0.

Signature

static UE_INL_API int32 GetHours( FTimespan A );

Parameters

Name Type Description Default
A FTimespan The timespan to query.

Return Type

int32

Example

Format a timespan as D:HH:MM C++
FTimespan T = FTimespan::FromHours(49.75);
int32 D = UKismetMathLibrary::GetDays(T);    // 2
int32 H = UKismetMathLibrary::GetHours(T);   // 1
int32 M = UKismetMathLibrary::GetMinutes(T); // 45
FString S = FString::Printf(TEXT("%d:%02d:%02d"), D, H, M);

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.