in reply to Re: Re: Re: Multiple date ranges
in thread Multiple date ranges

The timestamps were entered as free text in a web form. No checking of any kind - pick a format, any format. I have a roughly 200 line perl regexp script that has got (nearly)all of them into ISO format (YYYY-MM-DD).

Spotting who is currently a member is easy (apart from anything else, that info exists in another database I didn't tell you about). What I was looking for was a more elegant way of handling the other queries, e.g. using Date::Range, than a brute force approach...

Replies are listed 'Best First'.
Re: Multiple date ranges
by Hofmator (Curate) on Feb 03, 2003 at 13:44 UTC
    The timestamps were entered as free text in a web form.No checking of any kind - pick a format, any format. I have a roughly 200 line perl regexp script that has got (nearly)all of them into ISO format (YYYY-MM-DD).
    Did you give Date::Manip a try?? It's a big and slow module but quite good at parsing dates in any format, take a look at the ParseDate function. This could save you from having to program monsters like 200 line regex scripts ...

    -- Hofmator

Re: Re: Re: Re: Re: Multiple date ranges
by Anonymous Monk on Feb 03, 2003 at 13:34 UTC
    You know what, use DBD-SQLite.

    Date::Range is not for you (unless you got tons of memory, and wanna have 4500 Date::Range objects --- stupid)

    Build a new database out of your flat file, and SQL to query it any which way you want.

Re: Re: Re: Re: Re: Multiple date ranges
by Anonymous Monk on Feb 03, 2003 at 13:37 UTC
    The timestamps were entered as free text in a web form.
    I hope that's the #1 thing on your to-do list (give the users a pulldown menu, or simply use localtime/gmtime)

    You wanna handle SQL-esque type queries in a non-SQL way, you're gonna have to bend over backwards to do it.

    You need to involve another database and create kinds of indexes.