Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Get the Fiscal Year from Date

by l.frankline (Hermit)
on Jan 03, 2007 at 11:42 UTC ( [id://592745]=note: print w/replies, xml ) Need Help??


in reply to Get the Fiscal Year from Date

Hi

If my guess is right, then try this code

%Months = ( 'Jan'=>1, 'Feb'=>2, 'Mar'=>3, 'Apr'=>4, 'May'=>5, 'Jun'=>6, 'Jul'=>7, 'Aug'=>8, 'Sep'=>9, 'Oct'=>10, 'Nov'=>11, 'Dec'=>12 ); $_='Jan 2007'; if ($_=~/(\w{3}) (\d{4})/) { ($m,$y) = ($Months{$1},$2); $f=$y; $s=$y; } if ($m >= 1 && $m <= 6) { print "FY - Jul " . --$f . " - Jun " . $s . "\n"; } elsif ($m >= 7 && $m <= 12) { print "FY - Jul " . $f . " - Jun " . ++$s . "\n"; }

Output:

FY - Jul 2006 - Jun 2007

regards
Franklin

Don't put off till tomorrow, what you can do today.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-20 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found