Greg Schiedler wrote:
> Perl v5.6.1
>
> Trying to easily create some variable based on the current month and
> links to the two previous months. The filename(s) are based on two
> digit months MM--Filename. I have the filename part working but
> I need some guidancd on creating the MM-.
Rob Hanson wrote:
One note... if you have a daylight savings time that takes effect between
11pm and 1am this won't work. In the US DST is 2am, so it is safe.
Also, this might be a prettier solution...
use Time::Local;
use constant DAY => 86_400;
$current = time;
$previous = subtract_month(time, 1
al Message-
From: Hanson, Rob
Sent: Tuesday, September 07, 2004 6:33 PM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: Month-Year Links
The trick is to use Time::Local to find the first day of the month, then
subtract 1 day.
This prints:
09-2004
08-2004
07-2004
###
The trick is to use Time::Local to find the first day of the month, then
subtract 1 day.
This prints:
09-2004
08-2004
07-2004
###
use Time::Local;
use constant DAY => 86_400;
$current = time;
$previous = first_day($current) - DAY;
$current_2 = first_day($previous) - D