Advertisement
BobMe

calendar thing

Sep 10th, 2019
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. local year = 1970
  2. local month
  3.  
  4. seconds = os.time()
  5. minutes = 0
  6. hours = -7
  7. days = 7
  8. years = 0
  9.  
  10.  
  11. while seconds >= 60 do
  12. seconds = seconds - 60
  13. minutes = minutes + 1
  14. end
  15.  
  16. while minutes >= 60 do
  17. minutes = minutes - 60
  18. hours = hours + 1
  19. end
  20.  
  21. while hours >= 24 do
  22. hours = hours - 24
  23. days = days + 1
  24. end
  25.  
  26. while days >= 365 do
  27. days = days - 365
  28. years = years + 1
  29. end
  30.  
  31. yearss = years
  32. while yearss >= 4 do
  33. yearss = yearss - 4
  34. days = days+1
  35. end
  36.  
  37. local months = {
  38. 31, -- january
  39. 28, -- febuary
  40. 31, -- march
  41. 30, -- april
  42. 31, -- may
  43. 30, -- june
  44. 31, -- july
  45. 31, -- august
  46. 30, -- september
  47. 31, -- october
  48. 30, -- november
  49. 31 -- december
  50. }
  51.  
  52. function returnmonth(x)
  53. if x == 1 then
  54. return "January"
  55. elseif x == 2 then
  56. return "Febuary"
  57. elseif x == 3 then
  58. return "March"
  59. elseif x == 4 then
  60. return "April"
  61. elseif x == 5 then
  62. return "May"
  63. elseif x == 6 then
  64. return "June"
  65. elseif x == 7 then
  66. return "July"
  67. elseif x == 8 then
  68. return "August"
  69. elseif x == 9 then
  70. return "September"
  71. elseif x == 10 then
  72. return "October"
  73. elseif x == 11 then
  74. return "November"
  75. else
  76. return "December"
  77. end
  78. end
  79.  
  80. for i=1,#months do
  81. local sum = days-months[i]
  82. if sum >= 0 then
  83. days = sum
  84. else
  85. month = returnmonth(i)
  86. break
  87. end
  88. end
  89.  
  90.  
  91. --Line of strings
  92. if seconds < 10 then seconds = "0"..seconds end
  93. if minutes < 10 then minutes = "0"..minutes end
  94. if hours < 10 then hours = "0"..hours end
  95.  
  96. print(month..", "..days..", "..year+years.."\n"..hours.." : "..minutes.." : "..seconds)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement