Thread: Compare date
View Single Post
07-11-21, 08:38 PM   #2
kurapica.igas
A Chromatic Dragonspawn
Join Date: Aug 2011
Posts: 152
Lua Code:
  1. local time = os.time or _G.time
  2.  
  3. -- Use time API to get the timestamp
  4. local date1 = time{ year = 2012, month = 12, day = 20, hour = 0, min = 0, sec = 0 }
  5. local date2 = time{ year = 2012, month = 12, day = 21, hour = 0, min = 0, sec = 0 }
  6.  
  7. if math.floor(math.abs(date2 - date1) / (3600 * 24)) > 0 then
  8.     print("diff day")
  9. else
  10.     print("same day")
  11. end
  Reply With Quote