Sample code for 30+ languages & platforms
Lua Requires Chilkat v9.5.0.65+

DateTime - Get as Unix Time String

Demonstrates the GetAsUnixTimeStr method.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

local dateTime = chilkat.DateTime.new()

dateTime:set_from_current_system_time()

-- (in seconds since the epoch: 00:00:00 UTC on 1 January 1970)
local bLocal = true
print("Unix time: " .. dateTime:get_as_unix_time_str(bLocal))

-- Sample output for test run on 2-Dec-2016:

--     Unix time: 1480661608