Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: List of days in current month

by toolic (Bishop)
on Mar 13, 2014 at 18:38 UTC ( [id://1078226]=note: print w/replies, xml ) Need Help??


in reply to List of days in current month

use strict; use warnings; use Time::Piece qw(); my $t = Time::Piece->new(); my $month = $t->mon; my $year = $t->year; my $lday = $t->month_last_day; for (1 .. $lday) { printf "%02d/%02d/%04d\n", $month, $_, $year; } __END__ 03/01/2014 03/02/2014 ... 03/31/2014

Replies are listed 'Best First'.
Re^2: List of days in current month
by Anonymous Monk on Mar 13, 2014 at 19:33 UTC
    Thanks, that pointed me to the right direction:
    #!/usr/bin/env perl use strict; use warnings; use Time::Piece qw(); my $t = Time::Piece->new(); my $month = $t->mon; my $year = $t->year; my $lday = $t->month_last_day; my @dates = map sprintf( "%02d/%02d/%04d", $month, $_, $year ), 1 .. $ +lday; foreach my $date(@dates) { print $date."\n"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 00:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found