Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Credit to AlvinBlox
- function SecondsToTimestamp(seconds)
- seconds = math.max(seconds, 0) -- Get the highest value between seconds and 0
- local minutes = tostring(math.floor(seconds / 60)) -- Minutes
- local leftoverSeconds = tostring(seconds % 60) -- Seconds leftover from the minutes
- if #leftoverSeconds == 1 then
- -- Add an extra '0' because this is a single digit number (9, 8, 7, 6, etc.)
- leftoverSeconds = "0"..leftoverSeconds
- end
- return minutes..":"..leftoverSeconds
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement