WoW:API SecondsToTime
Jump to navigation
Jump to search
Converts a number of seconds into a localized, user readable timespan.
timePassed = SecondsToTime(seconds[, noSeconds]);
- Arguments
- Number seconds, Boolean noSeconds
- seconds
- The number of seconds to be represented.
- noSeconds
- Unless false or nil, seconds are omitted from the output. Note that omission of the parameter is effectively the same as setting it to nil.
- Returns
- timePassed
- Formatted, localized string representing the specified number of seconds.
- Example
local timePassed = SecondsToTime(5461) DEFAULT_CHAT_FRAME:AddMessage("5461 seconds is approximately " .. timePassed)
- Result
5461 seconds is approximately 1 Hr 31 Mins
- Description
- Converts a number of seconds to a user readable timespan. The exact result differs for each client language.
- Regardless of the noSeconds parameter, the function never returns than two different time units of precision. i.e. if seconds is greater than 3600, seconds will be omitted. If it is greater than 86400, minutes will also be omitted.
- This is not a "core" function. It is defined in FrameXML\UIParent.lua.