Advertisement
BobMe

VIDTUT_MCC

Dec 8th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. -- Military Clock Converter
  2. -- By: Memo1332 / Poison Test
  3.  
  4. seconds = 0 -- Initial Variables
  5. minutes = 0
  6. hours = 0
  7. days = 0
  8.  
  9. while seconds >= 60 do -- There are 60 seconds in a minute, so while seconds is greater
  10. seconds = seconds - 60 -- than 60 it will continously take away 60 values from seconds and add
  11. minutes = minutes + 1 -- 1 value to minutes
  12. end
  13.  
  14. while minutes >= 60 do -- Same thing as the previous function, just with different variables
  15. minutes = minutes - 60
  16. hours = hours + 1
  17. end
  18.  
  19. while hours >= 24 do -- There are 24 hours in one day, so while hours is greater
  20. hours = hours - 24 -- than 24 it will continously take away 24 values from hours and add
  21. days = days + 1 -- 1 value to days
  22. end
  23.  
  24. --[[
  25. This would be an area to put any of your scripts in
  26. the line of strings is not an area to pass or add things
  27. to if you do not know what you're doing, anything added in
  28. that is passed the line of strings potentially can error
  29. --]]
  30.  
  31.  
  32. --------------------------- Line Of Strings
  33.  
  34.  
  35. if seconds == 0 then seconds = "00" end -- If any variable is 0 it will be changed into a string so the
  36. if minutes == 0 then minutes = "00" end -- clock looks nicer and my ocd says it's okay.
  37. if hours == 0 then hours = "00" end
  38. if days == 0 then days = "00" end
  39.  
  40.  
  41. print(days..":"..hours..":"..minutes..":"..seconds) -- Every value combined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement