[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: AW: date arithmetic?
- From: "steffenj" <steffenj@...>
- Date: Wed, 24 Aug 2005 00:09:04 +0200
out of my mind (cases could be outer way round, not sure):
os.date("%Y %M %D %h %m %s")
will give you:
year month day hours minutes seconds
for more, see the Ansi C date function description, it should be possible to
find that on the web
-----Ursprüngliche Nachricht-----
Von: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] Im Auftrag von PA
Gesendet: Dienstag, 23. August 2005 22:24
An: Lua list
Betreff: date arithmetic?
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/