Re: Algorithm for "1st Tuesday", "last Saturday", etc.
- From: Bob Walton <see.sig@xxxxxxxxxxxxxxxx>
- Date: Mon, 29 Aug 2005 01:34:27 GMT
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 .
- References:
- Algorithm for "1st Tuesday", "last Saturday", etc.
- From: mcalhoun
- Algorithm for "1st Tuesday", "last Saturday", etc.
- Prev by Date: Algorithm for "1st Tuesday", "last Saturday", etc.
- Next by Date: jagged parameter arrays
- Previous by thread: Algorithm for "1st Tuesday", "last Saturday", etc.
- Next by thread: Re: Algorithm for "1st Tuesday", "last Saturday", etc.
- Index(es):