LuaScripts/getTime.lua

17 lines
400 B
Lua
Raw Permalink Normal View History

2021-01-08 13:32:55 +00:00
local internet = require("internet")
2021-01-08 14:06:36 +00:00
2021-01-08 14:40:53 +00:00
local handle = internet.request("http://api.timezonedb.com/v2.1/get-time-zone?key=INWE0H77BDN6&by=zone&zone=Europe/Moscow&format=json")
local result = ""
2021-01-08 13:32:55 +00:00
2021-01-08 14:40:53 +00:00
for chunk in handle do
result = result..chunk
2021-01-08 13:32:55 +00:00
end
2021-01-08 14:40:53 +00:00
local f = io.open("time.txt", "w")
f:write(result)
f:close()
f = io.open("time.txt", "r")
f:seek("set", 245)
local time = f:read(19)
f:close()
print(time)