lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

How does one do date arithmetic in Lua?

Right now, I'm manipulating the os.date's table directly:

local aDate = os.date( "*t" )

print( os.date( "%x", os.time( aDate ) ) )

-- find the end of the month
aDate.month = aDate.month + 1
aDate.day = 0

print( os.date( "%x", os.time( aDate ) ) )

> 08/23/05
> 08/31/05

Seems to work, but I'm not sure if this is by luck or design.. :)

Thoughts?

TIA!

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/