See perl http://datetime.perl.org/ for more info.use DateTime 0.10; my $today = DateTime->now(); warn $today->time_zone_short_name(); warn $today->datetime(); $today->subtract( months => 1 ); # or $today->subtract_duration( DateTime::Duration->new( months => 1 ) + ); warn $today->datetime(); my $dt = DateTime->last_day_of_month( year => $today->year, month => $today->month, ); die $dt->datetime(); __END__ UTC at soy.pl line 4. 2003-04-28T11:17:32 at soy.pl line 5. 2003-03-28T11:17:32 at soy.pl line 11. 2003-03-31T00:00:00 at soy.pl line 18.
|
MJD says you can't just make shit up and expect the computer to know what you mean, retardo! I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests. ** The Third rule of perl club is a statement of fact: pod is sexy. |
In reply to Re: How do i get "the last day of last month"?
by PodMaster
in thread How do i get "the last day of last month"?
by kiseok7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |