Advertisement
aquilon

Time

Apr 9th, 2020
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.34 KB | None | 0 0
  1. os.loadAPI("json")
  2.  
  3. local function get_time()
  4.     local url = "http://worldtimeapi.org/api/timezone/Europe/Paris"
  5.  
  6.     local r = http.get(url)
  7.  
  8.     if r then
  9.         local time = json.decode(r.readAll())
  10.         time = time.datetime
  11.         time = time:sub(12, 19)
  12.         r.close()
  13.         return time
  14.     end
  15. end
  16.  
  17. print(get_time())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement