#!/usr/bin/env lua require("posixtz") print(posixtz.from_file("/usr/share/zoneinfo/Europe/Stockholm")) t = posixtz.parse("CET-1CEST,M3.5.0,M10.5.0/3") local out = "" out = out .. "POSIX TZ: '"..t.std.."'\n" out = out .. "GMT Offset, where positive is West of GMT: '"..t.offset.total.."'\n" if t.dst then out = out .. "DST zone is called '"..t.dst.name.."'\n" local function dstinfo (pos) local info = "" if t.dst[pos].hour then info = info .. "at '"..t.dst[pos].hour.."' hours (0-23) " end if t.dst[pos].week then info = info .. "on weekday '"..t.dst[pos].weekday.."' " info = info .. "of week '"..t.dst[pos].week.."' " info = info .. "of the month '"..t.dst[pos].month.."'" else info = info .. "on day '"..t.dst[pos].day.."' " info = info .. "of month '"..t.dst[pos].month.."'" end return info end out = out .. "DST begins " out = out .. dstinfo("start") .. "\n" out = out .. "DST ends " out = out .. dstinfo("stop") .. "\n" end io.write(out)