Re: Algorithm for "1st Tuesday", "last Saturday", etc.



mcalhoun@xxxxxxx wrote:

Can someone point me to an algorithm that, given a speific month and year,
can convert "dates" such as "1st Tuesday", "last Saturday", etc. to actual
numeric dates.

I've tried a (DOS-based) executable called "DATES.EXE", but it doesn't
handle "even" and "odd" years (which I use for tax purposes) so I wrote
a PRE-processor, and I don't like its output format so I wrote a POST-
processor.  If I could find the appropriate algorithm as described agove,
it would probably just be easier to write one program!

The Perl module "Date::Manip" does a pretty fair job of such date conversions. You can find the module on


http://search.cpan.org/src/SBECK/DateManip-5.44/Manip.pm

Perusing that code may give some ideas.

HTH.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
.