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

Re^2: create array from strftime

by taint (Chaplain)
on Jun 20, 2012 at 18:07 UTC ( #977439=note: print w/replies, xml ) Need Help??

in reply to Re: create array from strftime
in thread create array from strftime

Or read the output of strftime(3). :)
Here's another example:
use POSIX qw(strftime); # POSIX is your friend # see man strftime(3) for format options my $gmtstring = strftime "%F %H:%I:%S %z", localtime; print $gmtstring;

Hope this helps.

my $perl_version( 5.12.4 );
print $perl_version;

Replies are listed 'Best First'.
Re^3: create array from strftime
by ikegami (Pope) on Jun 20, 2012 at 19:45 UTC
    How does one use that to populate $day, $month and $year?
      I used this to populate Month. Couldn't something similar be used for Year & Day?
      use Time::Piece; use strict; my @months = qw( 01 02 03 04 05 06 07 08 09 10 11 12 ); my $t = localtime; print localtime->month(@months);
      my $perl_version( 5.12.4 );
      print $perl_version;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://977439]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2018-07-18 18:59 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (393 votes). Check out past polls.