Date parsing

Russ Allbery rra at stanford.edu
Tue Sep 3 19:27:07 UTC 2002


bill davidsen <davidsen at tmr.com> writes:

> Sounds like a good job to me! I think a strict mode and relaxed mode
> would be enough, with relaxed mode accepting virtually any human
> readable format.

So how far do you want to go with that?  'cause parsedate does a lot but
doesn't quite reach that.  *heh*

windlord:~> perl -MDate::Manip -e 'print ParseDate("last sunday"), "\n"'
2002090112:24:44

I do think that we should generally reject dates that aren't in RFC 2822
format, so much as possible.  Just in terms of generally being good
network citizens and not giving to clients dates that they can't handle.

> Unless you care about the day of the week, it can be ignored however
> spelled.

Yes, my parser does this.  In fact, every date parser for Usenet that I've
seen does this and doesn't bother checking whether the day of the week was
actually correct.

> And of course this can be a resource by itself, I'd love to plug a
> better date parser into a few other applications!

Probably the best generally available parser that I'm aware of is
getdate.y, which is an extension of the code that underlay parsedate.y
originally.  Unfortunately, the authors chose to make it GPL rather than
keeping it public domain.

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list