in reply to Re: The next third tuesday of the month
in thread The next third tuesday of the month

Before using Date::Tie, I played (struggled) with Date::Manip's ParseRecur, but I didn't know, and was unable to find with Google, in which form the start and end times were supposed to be. Because I didn't want a list, just the next one, this was important.

The module offered no clear examples. The synopsis only lists the available functions with their arguments, and the in the examples it is not clear in what format the date should be. Maybe it is somewhere in the documentation, but I didn't feel like reading this 41 (A4) page monster.

Thanks for the post, though.

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.

  • Comment on Re: Re: The next third tuesday of the month

Replies are listed 'Best First'.
Re: The next third tuesday of the month
by Abigail-II (Bishop) on Nov 14, 2002 at 13:26 UTC
    #!/usr/bin/perl use strict; use warnings 'all'; use Date::Manip; my $month = UnixDate ParseDate ("today"), "%B %Y"; my $date = ParseDate "3rd tuesday in $month"; if ($date lt ParseDate ("now")) { my $month = UnixDate ParseDate ("next month"), "%B %Y"; $date = ParseDate "3rd tuesday in $month"; } print UnixDate $date => "%F\n";

    The documentation of the module comes with lots of examples (not only the ones in the Examples section). The routines are discussed into detail in the Routines section, taking most of the 41 page documentation....

    Abigail

Re: Re: Re: The next third tuesday of the month
by markguy (Scribe) on Jul 30, 2003 at 23:48 UTC
    I realize this is an old post to be replying to, but hit it when messing with &ParseRecur() and thought I'd chime in.

    The thing to keep in mind about Date::Manip is that it almost doesn't *care* what format you hand it dates. If you can parse it in your head to come out to a legitimate date, chances are good it can too. Admittedly you can get in a lot of trouble this way, but for amusement some time, take a form with a text input for a date field, release it to the general public and then just parse that field with Date::Manip; log results however you like.

    When I did this, I was astonished by the ludicrous number of what I would have considered to be bogus dates that Date::Manip did something intelligent with. It might have returned a partial date at times (and considering your own circumstances, this might be a very bad thing), but it successfully handled *far* more than I had hoped for.

    Yes, it's a beast of a module... it's still getting my vote for basic prototyping and all but the most speed-critical code. It's just too keen.