RealDocs

UKismetMathLibrary::FromHours

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

Description

Constructs an FTimespan representing the given number of hours. Fractional values are accepted, so 1.5 produces a 90-minute span.

Caveats & Gotchas

  • There is no range check on the input — extremely large values will silently overflow the underlying int64 tick counter. The safe usable range is roughly ±29,000 years.
  • Negative hours produce negative timespans, which are valid but can mislead callers expecting a duration to always be positive. Consider asserting Days >= 0 in game code if sign matters.

Signature

static ENGINE_API FTimespan FromHours(double Hours );

Parameters

Name Type Description Default
Hours double Number of hours (may be fractional).

Return Type

FTimespan

Example

Set a 24-hour session expiry duration C++
FTimespan SessionLifetime = UKismetMathLibrary::FromHours(24.0);
FDateTime ExpiresAt = FDateTime::UtcNow() + SessionLifetime;

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.