Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Gettting the last Friday of every month using Time::Piece

by Anonymous Monk
on Jun 30, 2014 at 17:58 UTC ( #1091756=note: print w/replies, xml ) Need Help??


in reply to Re: Gettting the last Friday of every month using Time::Piece
in thread Gettting the last Friday of every month using Time::Piece

Whats with the 34?
my $dd = 34 - $t->_wday; # sun=0

Replies are listed 'Best First'.
Re^3: Gettting the last Friday of every month using Time::Piece
by LanX (Cardinal) on Jun 30, 2014 at 18:14 UTC
    35= 5*7 days after the 1st (the "36th") you'll have the same weekday again

    36- _wday gives a Sunday

    2 days before Sunday is Friday => 34- _wday

    ... and so on

    Cheers Rolf

    (addicted to the Perl Programming Language)

      Where is Time::Piece::_wday explained? I realize, of course, that it's documented in perldoc Time::Piece (where the definition of "documented" is "merely mentioned, with an ambiguous comment about it"). More generally, where are any of the of Time::Piece methods explained?

        $t->wday # 1 = Sunday $t->_wday # 0 = Sunday $t->day_of_week # 0 = Sunday
        What is unclear? Extrapolating that Sunday+1 == Monday, Sunday+2 = Tuesday, etc.? That one starts at one, and the other two start at zero? That Sunday is considered the start of the week?
        > Where is Time::Piece::_wday explained?

        This ...

        > corelist Time::Piece Time::Piece was first released with perl 5.009005

        ... and this ...

        The module actually implements most of an interface described by Larry Wall on the perl5-porters mailing list here: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-01/msg00241.html

        ... explain that ...

        • it's popular because it is core and old
        • it's documentation style is not "main stream", because it is old

        If you don't like it ...

        • either use a more "modern" module from CPAN
        • or try to improve the documentation to your "standards", like toolic already explained.

        That's the normal evolution of open source software! :)

        Cheers Rolf

        (addicted to the Perl Programming Language)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1091756]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2021-04-14 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?