[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Date Object and Functions
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 10 Dec 2003 11:01:52 -0200
>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