Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: printing element of anonymous array

by 1nickt (Abbot)
on Mar 03, 2018 at 20:51 UTC ( #1210293=note: print w/replies, xml ) Need Help??


in reply to printing element of anonymous array

Using the core Perl module Time::Piece (which overrides the built-in functions localtime and gmtime, providing functions that return objects):

use Time::Piece;
print gmtime->wday;


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: printing element of anonymous array
by haukex (Chancellor) on Mar 04, 2018 at 12:03 UTC

      True, but there's a reason Time::Piece was placed in core, and it ain't because Time::gmtime had feature bloat.

      Besides the aforementioned wday(), which provides a one-indexed numerical value for the day of the week, Time::Piece also provides _wday() and day_of_week() for getting the zero-indexed value, as well as fullday() to get the full name of the day, and day() and wdayname() for an abbreviated version of the name.


      The way forward always starts with a minimal test.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2020-01-21 22:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?