WoW:API SecondsToTimeAbbrev: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Initial description of function)
 
m (Move page script moved page API SecondsToTimeAbbrev to API SecondsToTimeAbbrev without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{framexmlfunc|FrameXML/UIParent.lua}} __NOTOC__
<br>{{framexmlfunc|FrameXML/UIParent.lua}} __NOTOC__





Latest revision as of 04:47, 15 August 2023


WoW API < SecondsToTimeAbbrev

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


TimeFormat, Value = SecondsToTimeAbbrev(TimeDuration);

Converts an amount of time (TimeDuration) into a formatted string (TimeFormat) and value.


Parameters[edit]

Arguments[edit]

TimeDuration
Number - The amount of time to convert.

Returns[edit]

TimeFormat
String - A string in the format "%d s|m|h|d"
Value
Number - The seconds, minutes, hours, or days that will fit into the formated string.


Example[edit]

Results below, respectively

local msg, val = SecondsToTimeAbbrev(30)
output = format(msg, val)
DEFAULT_CHAT_FRAME:AddMessage(output)
local msg, val = SecondsToTimeAbbrev(900)
output = format(msg, val)
DEFAULT_CHAT_FRAME:AddMessage(output)
local msg, val = SecondsToTimeAbbrev(3600)
output = format(msg, val)
DEFAULT_CHAT_FRAME:AddMessage(output)
local msg, val = SecondsToTimeAbbrev(86400)
output = format(msg, val)
DEFAULT_CHAT_FRAME:AddMessage(output)

Result[edit]

30 s
15 m
1 h
1 d

Details[edit]