Sam Harris wrote:
> I am trying to extract last month's date from today's date as in
> "Jan" or "Feb"....is there a switch to enable that ?

Not a 'switch'. I'm not sure what you had in mind.

You can get the current local date/time by calling 'localtime'.
In array context, this function returns a list whose fifth
element is the current month. (See perldoc -f localtime
for the complete list). You can easily calculate the
previous month by subtracting 1, like this:

    my ($thismonth, $lastmonth);

    $thismonth = (localtime)[4];
    (($lastmon = $mon) -= 1) %= 12;

Note that the month is zero-based, from zero for January
to eleven for December.

I have a suspicion, though, that you want a little more
than this. There are various date-orientated modules
which may be useful. I suggest you explain your problem
a little more then somebody will be able to help you.

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to