Hi all-knowing. wonderful, helpful folks (I hope that's enough grovelling)?..

I have two ..tasks..I need to perform concerning date manipulation. I've searched high and low without success.

Firstly, I'm wondering if there's a perl module that enables me to find out whether a Tuesday is the 1st, 2nd, 3rd, 4th or 5th Tuesday in the month.

I need to run a process that does one thing on one Tuesday and an alternate thing on the next Tuesday, ad infinitum. I'm guessing the way to do it would be to find the odd/even numbered Tuesdays from epoch, but I'm buggered if I can work out how to do it.

The second issue I have is working out if a date 15 days from a given date is a weekend, i.e. if I'm given day 5 as input, I need to ascertain if day 20 is a weekend, so that I can run the job on the preceding Friday (18th or 19th).

I appreciate you prefer people to show the code they've written and the issues they've found, but quite honestly I've not been able to come up with anything worthwhile that isn't long winded or comes even close to working.

I really would appreciate any suggestions I could try

Thanks very much
Kev


In reply to Dates - which Tuesday is it by viffer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.