WoW:API SecondsToTime: Difference between revisions
Jump to navigation
Jump to search
(initial version) |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{framexmlfunc|FrameXML/UIParent.lua}} __NOTOC__ | |||
timePassed = SecondsToTime(seconds[, noSeconds]); | |||
Converts a number of seconds into a localized, user readable timespan. | Converts a number of seconds into a localized, user readable timespan. | ||
== Parameters == | |||
; | === Arguments === | ||
: seconds, noSeconds | |||
:;seconds : Number - The number of seconds to be represented. | |||
: | :;noSeconds : [[Boolean]] (optional) - If ''true'', seconds are omitted from the output. (Omitting it == ''false'') | ||
=== Returns === | |||
:; | :;timePassed : String - Formatted, localized string representing the specified number of seconds. | ||
== Example == | |||
local timePassed = SecondsToTime(5461) | local timePassed = SecondsToTime(5461) | ||
DEFAULT_CHAT_FRAME:AddMessage("5461 seconds is approximately " .. timePassed) | DEFAULT_CHAT_FRAME:AddMessage("5461 seconds is approximately " .. timePassed) | ||
=== Result === | |||
5461 seconds is approximately 1 Hr 31 Mins | 5461 seconds is approximately 1 Hr 31 Mins | ||
== Details == | |||
: | : 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 more 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. | |||
Revision as of 14:23, 5 September 2006
← WoW API < SecondsToTime
- This function is implemented in Lua here FrameXML/UIParent.lua.
timePassed = SecondsToTime(seconds[, noSeconds]);
Converts a number of seconds into a localized, user readable timespan.
Parameters
Arguments
- seconds, noSeconds
- seconds
- Number - The number of seconds to be represented.
- noSeconds
- Boolean (optional) - If true, seconds are omitted from the output. (Omitting it == false)
Returns
- timePassed
- String - 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
Details
- 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 more 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.