Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
use strict; use warnings; use Time::Piece; use Time::Seconds; my $t = Time::Piece->new(); my $year = $ARGV[ 0 ] || 2014; foreach my $month ( 1 .. 12 ) { my $tdates = $t->strptime("$year/$month/1", '%Y/%m/%d'); my $day_of_month = $tdates->month_last_day(); $tdates = $t->strptime("$year/$month/$day_of_month", '%Y/%m/%d'); while ($tdates->wdayname ne 'Fri') { $tdates -= ONE_DAY; } printf "Last Friday of Month %02d is %s\n", $month, $tdates->ymd() +; } __END__ Last Friday of Month 01 is 2014-01-31 Last Friday of Month 02 is 2014-02-28 Last Friday of Month 03 is 2014-03-28 Last Friday of Month 04 is 2014-04-25 Last Friday of Month 05 is 2014-05-30 Last Friday of Month 06 is 2014-06-27 Last Friday of Month 07 is 2014-07-25 Last Friday of Month 08 is 2014-08-29 Last Friday of Month 09 is 2014-09-26 Last Friday of Month 10 is 2014-10-31 Last Friday of Month 11 is 2014-11-28 Last Friday of Month 12 is 2014-12-26

In reply to Re: Gettting the last Friday of every month using Time::Piece by toolic
in thread Gettting the last Friday of every month using Time::Piece by Anonymous Monk

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (6)
    As of 2021-04-13 23:35 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found