[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Date Object and Functions
- From: Stoil Todorov <torpedo_st@...>
- Date: Wed, 10 Dec 2003 05:57:24 -0800 (PST)
Thank You, Luiz
Now everything is OK:-)
I read about strfind function in "Programing in
Lua",Roberto Ierusalimschy but it is about Lua 4.0...
In my opinion, reading "Lua 5.0 Reference Manual",
gfind is the nearest by strfind...but I don't know why
it does not work as well I suppose:-(
--- Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
> >d1.day, d1.month, d1.year = string.gfind( date1,
> "(%d+).(%d+).(%d+)");
> >...but gfind do not work for me:-(
>
> You need to ignore the first 2 return values. Try
> the code below.
> --lhf
>
> function str2time(s)
> local d={}
> local a,b
> a, b, d.day, d.month, d.year = string.find(s,
> "(%d+).(%d+).(%d+)");
> return os.time(d)
> end
>
> function diff(a,b)
> return
> os.difftime(str2time(b),str2time(a))/(60*60*24)
> end
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/