Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Syntactic Confectionery Delight
 
PerlMonks  

Re: How to get last day of 2 months ago

by Anonymous Monk
on Mar 11, 2011 at 17:01 UTC ( #892698=note: print w/ replies, xml ) Need Help??


in reply to How to get last day of 2 months ago

#!/usr/bin/perl use strict; use warnings; use 5.012; use Time::Local qw( timegm_nocheck ); my ($y, $m, $d) = (localtime)[5,4,3]; my $start = scalar gmtime(timegm_nocheck(0,0,0, (1-1), $m-1, $y)); my $end = scalar gmtime(timegm_nocheck(0,0,0, (1-1), $m, $y)); say "Today is " . localtime; say join "\n", $start, $end;
** prints
Today is Fri Mar 11 11:56:50 2011 Mon Jan 31 00:00:00 2011 Mon Feb 28 00:00:00 2011


Comment on Re: How to get last day of 2 months ago
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://892698]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2014-04-18 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (466 votes), past polls