in reply to Month Dates
Using core functionality:
use Time::Local qw( timelocal_nocheck ); use POSIX qw( strftime ); my ($sec,$min,$hour,$day,$mon,$year) = localtime; for (0..3) { my $time = timelocal_nocheck($sec,$min,$hour,$day,$mon-$_,$year); print(strftime("%Y-%m", localtime($time)), "\n"); }
Update: Nevermind. Buggy because of the following change to Time::Local:
Removed the code from the docs that implied that the *_nocheck variants were created for doing date math. They're just for speeding things up when you have known valid data. If you pass them invalid data, you'll probably get an incorrect answer. See #31421 on rt.perl.org for discussion.
I do get invalid data.
|
|---|