in reply to Re: Datetime Problem - Wrong Time
in thread Datetime Problem - Wrong Time
Oh it subtracts twice!!! I just literally facepalmed.... Updated to:
#!/usr/bin/perl use DateTime; $dt = DateTime->now->subtract(months => 1); $month = $dt->strftime("%m"); $year = $dt->year(); print $dt."\n"; print $month."\n"; print $year."\n";
Works now! Thanks monks :D
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Datetime Problem - Wrong Time
by tobyink (Canon) on Feb 07, 2012 at 23:03 UTC |