Advertisement
MiraMiraMira

startupClock

Dec 1st, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. function daysToDate(days)
  2.   year = math.floor(days/360+2000)
  3.   month = math.floor((days%360)/30+1)
  4.   day = math.floor((days%360)%30+1)
  5.   if month == 1 then month = "Jan"
  6.     elseif month == 2 then month = "Feb"
  7.     elseif month == 3 then month = "Mar"
  8.     elseif month == 4 then month = "Apr"
  9.     elseif month == 5 then month = "May"
  10.     elseif month == 6 then month = "Jun"
  11.     elseif month == 7 then month = "Jul"
  12.     elseif month == 8 then month = "Aug"
  13.     elseif month == 9 then month = "Sep"
  14.     elseif month == 10 then month = "Oct"
  15.     elseif month == 11 then month = "Nov"
  16.     elseif month == 12 then month = "Dec"
  17.     else month = "Month"
  18.   end
  19.   date = {month, day, year}
  20.   return date
  21. end
  22.    
  23.  
  24. while true do
  25. m = peripheral.wrap("right")
  26. m.clear()
  27. m.setCursorPos(5,1)
  28. m.setTextScale(2)
  29. m.write(textutils.formatTime(os.time(), false))
  30. m.setCursorPos(2,2)
  31. date = daysToDate(os.day())
  32. m.write(string.format("%s %s, %s", date[1], date[2], date[3]))
  33. sleep (1)
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement