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
There is also spanhours, spanminutes and spanseconds methodsCode:-- get the days between two dates local diff = date.diff("Jan 7 2010", "Jan 12 2010") Dialog.Message("Diff", diff:spandays())
You can also do cool stuff like this
Code:local a = date("Jan 7 2010") local b = date("Jan 12 2010") local days = (b-a):spandays()

Reply With Quote

