PerlSufi has asked for the wisdom of the Perl Monks concerning the following question:
returns the date in the formats that I want. (MMDDYY)use DateTime; use Date::Format; my $one_month_ago = DateTime->today->subtract(months => 1); print $one_month_ago = DateTime->last_day_of_month( month => $one_month_ago->month, year => $one_month_ago->year, )->strftime("%m%d%y"); my $start_date = DateTime->today->subtract( months => 1); print $start_date->strftime("%m%d%y");
Why is this happening? Thanks in advance for your input..my $start_date = DateTime->today->subtract( months => 1); $start_date->strftime("%m%d%y"); print $start_date; my $end_date = DateTime->today->subtract(months => 1); $end_date = DateTime->last_day_of_month( month => $end_date->month, year => $end_date->year, )->strftime("%m%d%y"); print $end_date; #This block of code is intended to fill in the required forms $mech->get("https://caps.usps.gov/ssl_caps/caps_ai.asp"); my $usr = "asdf"; my $pw = "asdf"; $mech->form_number(1); $mech->field( "capsn", $usr); $mech->form_number(2); $mech->field("capsp", $pw); $mech->form_number(3); $mech->field( "startdate", $start_date); $mech->form_number(4); $mech->field( "enddate", $end_date); $mech->form_number(5); $mech->select("format", "2"); $mech->click();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DateTime formatting problem
by moritz (Cardinal) on Apr 30, 2013 at 17:59 UTC | |
by PerlSufi (Friar) on Apr 30, 2013 at 18:07 UTC | |
|
Re: DateTime formatting problem
by PerlSufi (Friar) on Apr 30, 2013 at 17:54 UTC |