lua-users home
lua-l archive

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


On Tue, Mar 20, 2012 at 01:06, Alexander Gladysh <agladysh@gmail.com> wrote:
> On Tue, Mar 20, 2012 at 00:37, liam mail <liam.list@googlemail.com> wrote:
>> On 19 March 2012 20:15, Alexander Gladysh <agladysh@gmail.com> wrote:

>>> I'm looking for Lua analogue for this nice JS library:
>>> http://www.datejs.com/ (bindings to some C library would do)
>>>
>>> In particular I'm interested in date.parse() and date.parseExact() methods:
>>>
>>> http://code.google.com/p/datejs/wiki/APIDocumentation#parseExact
>>> http://code.google.com/p/datejs/wiki/APIDocumentation#parse
>>>
>>> ...but most other methods look useful too.
>>>
>>> Any clues?
>>>
>>> Any reusable C libraries for date.parse(), maybe?
>
>> strptime[1] or maybe another implementation such as [2] which is BSD
>
> How would this help me to parse "yesterday" or "week ago" as a date?
>
>> [1] http://linux.die.net/man/3/strptime
>> [2] http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/time/strptime.c?rev=HEAD
>
> https://github.com/agladysh/lua-getdate/blob/master/src/lua-getdate.c

Sorry, I probably was too terse :-)

So, yes, strptime() a good thing for building parseExact, thank you.

But the main problem is parse() for parsing "approximate dates" like
"week ago" or "tomorrow".

BTW, In search for a C implementation I've asked this question on SO:
http://stackoverflow.com/questions/9777494/c-library-to-parse-approximate-dates

Alexander.