RealDocs

UKismetMathLibrary::GetSeconds

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

Description

Returns the seconds component of the timespan (whole seconds remaining after extracting full minutes). Range is -59 to +59.

Caveats & Gotchas

  • This is the seconds *component* only — a timespan of 125 seconds returns 5 (GetMinutes returns 2). For total seconds use FTimespan::GetTotalSeconds() in C++.
  • Sub-second data (milliseconds/nanoseconds) is not included in the return value; combine with GetMilliseconds for a decimal-seconds display.

Signature

static UE_INL_API int32 GetSeconds( FTimespan A );

Parameters

Name Type Description Default
A FTimespan The timespan to query.

Return Type

int32

Example

Format elapsed time as M:SS.mmm C++
FTimespan T = FTimespan::FromSeconds(125.750);
int32 M  = UKismetMathLibrary::GetMinutes(T);     // 2
int32 S  = UKismetMathLibrary::GetSeconds(T);     // 5
int32 Ms = UKismetMathLibrary::GetMilliseconds(T); // 750
FString Out = FString::Printf(TEXT("%d:%02d.%03d"), M, S, Ms);

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.