in reply to Convert Date formats

I've made too many mistakes coverting dates with my own code. I almost always reach for Date::Parse and Date::Format which give you the very handy str2time and time2str subs.

In this case though, NOV-07 was too ambiguous for str2time. Adding 1- to make 1-NOV-07 fixed it.

#!/usr/bin/perl use warnings; use strict; use Date::Format; use Date::Parse; my $thingy = q{NOV-07}; my $time = str2time(qq{1-$thingy}); my $date = time2str(q{%Y/%m}, $time); print $date;
2007/11