UKismetMathLibrary::GetTotalHours
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the total elapsed time of the timespan expressed as a fractional number of hours. Unlike the Hours component accessor, this includes contributions from days, minutes, seconds, and fractions.
Caveats & Gotchas
- • This returns the *total* hours across the entire span — not just the hours component. A timespan of 1 day and 6 hours returns 30.0, not 6.0. Use FTimespan::GetHours() if you want only the hours component.
- • The return type is double, but Blueprint exposes this as a float pin in older project settings. If you need sub-second precision in Blueprint, verify your project has float precision set to double.
Signature
static UE_INL_API double GetTotalHours( FTimespan A ); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FTimespan | The timespan to query. | — |
Return Type
double Example
Convert timespan to hours for a UI display C++
FTimespan Elapsed = FTimespan::FromDays(1.5);
double TotalHours = UKismetMathLibrary::GetTotalHours(Elapsed);
// TotalHours == 36.0 See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?