Fandom

WoWWiki

USERAPI SecondsToDays

104,634pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

This page documents a user-defined function that you can copy and paste into your addon. Replace <PREFIX> with your AddOn's prefix to avoid conflicts between different versions of these functions.
User defined functions < SecondsToDays

Fast function for converting the TIME_PLAYED_MSG response (or any source of seconds) to a X days/X hours/X minutes/X seconds format.

secondsToDays(inputSeconds)


Function Parameters Edit

Inputs Edit

inputSeconds
inputSeconds 
Number

Returns Edit

"X days/X hours/X minutes/X seconds"
X days/X hours/X minutes/X seconds 
String


DetailsEdit

Works with any amount of seconds

CodeEdit

function secondsToDays(inputSeconds)
 fdays = math.floor(inputSeconds/86400)
 fhours = math.floor((bit.mod(inputSeconds,86400))/3600)
 fminutes = math.floor(bit.mod((bit.mod(inputSeconds,86400)),3600)/60)
 fseconds = math.floor(bit.mod(bit.mod((bit.mod(inputSeconds,86400)),3600),60))
 return fdays.." days/"..fhours.." hours/"..fminutes.." minutes/"..fseconds.." seconds"
end

Also on Fandom

Random Wiki