WoW:API SecondsToTime: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(initial version)
 
m (Move page script moved page API SecondsToTime to API SecondsToTime without leaving a redirect)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<center>'''SecondsToTime''' ''-Documentation by [[User:Thorarin|Thorarin]]-''</center>
<br>{{framexmlfunc|FrameXML/UIParent.lua}} __NOTOC__
 
 
timePassed = SecondsToTime(seconds[, noSeconds]);
 
Is defined in UIParent.lua as: function SecondsToTime(seconds, noSeconds, notAbbreviated, maxCount)


Converts a number of seconds into a localized, user readable timespan.
Converts a number of seconds into a localized, user readable timespan.


timePassed = SecondsToTime(seconds[, noSeconds]);


----
== Parameters ==
;''Arguments''
=== Arguments ===
 
: seconds, noSeconds
 
:;seconds : Number - The number of seconds to be represented.


: Number seconds, Boolean noSeconds
:;noSeconds : [[Boolean]] (optional) - If ''true'', seconds are omitted from the output. (Omitting it == ''false'')


:;seconds : The number of seconds to be represented.
=== Returns ===


:;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.''
:;timePassed : String - Formatted, localized string representing the specified number of seconds.


----
;''Returns''


:;timePassed : Formatted, localized string representing the specified number of seconds.
== Example ==


----
;''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''
=== Result ===
  5461 seconds is approximately 1 Hr 31 Mins
  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.
== Details ==


: This is not a &quot;core&quot; function. It is defined in <tt>FrameXML\UIParent.lua</tt>.
: 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.
{{Template:WoW API}}

Latest revision as of 04:47, 15 August 2023


WoW API < SecondsToTime

"I" iconThis function is implemented in Lua here FrameXML/UIParent.lua.


timePassed = SecondsToTime(seconds[, noSeconds]);
Is defined in UIParent.lua as: function SecondsToTime(seconds, noSeconds, notAbbreviated, maxCount)

Converts a number of seconds into a localized, user readable timespan.


Parameters[edit]

Arguments[edit]

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[edit]

timePassed
String - Formatted, localized string representing the specified number of seconds.


Example[edit]

local timePassed = SecondsToTime(5461)
DEFAULT_CHAT_FRAME:AddMessage("5461 seconds is approximately " .. timePassed)

Result[edit]

5461 seconds is approximately 1 Hr 31 Mins


Details[edit]

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.