Dermot
03-11-2010, 07:23 PM
Very nice OOP style Lua date & time library here http://luaforge.net/frs/?group_id=209&release_id=508
Just drop the date.lua file in the Scripts folder and add require("date") to your globals. There is a very good help file included.
Example of the diff method
-- get the days between two dates
local diff = date.diff("Jan 7 2010", "Jan 12 2010")
Dialog.Message("Diff", diff:spandays())
There is also spanhours, spanminutes and spanseconds methods
You can also do cool stuff like this
local a = date("Jan 7 2010")
local b = date("Jan 12 2010")
local days = (b-a):spandays()
Just drop the date.lua file in the Scripts folder and add require("date") to your globals. There is a very good help file included.
Example of the diff method
-- get the days between two dates
local diff = date.diff("Jan 7 2010", "Jan 12 2010")
Dialog.Message("Diff", diff:spandays())
There is also spanhours, spanminutes and spanseconds methods
You can also do cool stuff like this
local a = date("Jan 7 2010")
local b = date("Jan 12 2010")
local days = (b-a):spandays()