Alan Clifford <lists(_at_)clifford(_dot_)ac> writes:
Date seems good at parsing dates and I am not into reinventing the wheel,
[snip stuff using GNU date]
and secondly, I found an example of a bad date in a spam that didn't cause
date to fail:
date -d "Wed, Jun 2002 23:01:09"
Fri Nov 23 23:01:09 GMT 2007
As it happens, this result is OK for the next 5 years as variations of
this always seem to result in the year 2007 but it is not ideal.
Date is just making its best effort.
date -d "Wed, Jun 31 23:01:09"
and you should get something like
Mon Jul 1 23:01:09 GMT 2002
which should show you how date is trying hard to figure it out.
It's actually very convenient for things like figuring out what
60 days after June 10 is (just feed it "June 70").
November 23, 2007 is 2002 days after May 31, 2002, which is how
it's parsing "Wed, Jun 2002" (it ignores the "Wed," and it assumes
the current year).
procmail mailing list