Hi Monks, newbie to Perl and have a little bit of a problem, but should be quite simple to work out for someone more experienced. I have a small script to work out the date last month and the year last month that looks like this:
#!/usr/bin/perl use DateTime; $dt = DateTime->now(); $month = $dt->subtract(months => 1)->strftime("%m"); $year = $dt->subtract(months => 1)->year(); print $dt."\n"; print $month."\n"; print $year."\n";
System date at time of writing is: Tue Feb 7 14:47:55 GMT 2012 which should give me a month of 01, and a year of 2012 right? So why is the output: 2011-12-07T14:47:55 01 2011 :(
In reply to Datetime Problem - Wrong Time by solarisfire
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |