data67 has asked for the wisdom of the Perl Monks concerning the following question:
#TEST By FY or CY### my $go = param('go'); if ($go eq "FY02") { $sdate = "2001/06/01" && $edate = "2002/05/31"; } elsif ($go eq "CY02") { $sdate = "2002/01/01" && $edate = "2002/12/31"; } elsif ($go eq "FY01") { $sdate = "2000/06/01" && $edate = "2001/05/31"; } elsif ($go eq "CY01") { $sdate = "2001/01/01" && $edate = "2001/12/31"; } elsif ($go eq "FY00") { $sdate = "1999/06/01" && $edate = "2000/05/31"; } else { $sdate = "2000/01/01" && $edate = "2000/12/31"; } @ofld = ("?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", " +?", "?", "?", "?", "?"); foreach $line (@loads) { @flds = split (/!/, $line, 17); next if $sdate lt $flds[$DTE] && $flds[$DTE] lt $edate; + #date range foreach $field (@flds) { $field =~ s/\s+$//; if ($field =~ m!(....)/(..)/(..)!) { #r +eorg. date style $field = "$2/$3/$1"; } } $flds[1] = $syst{$flds[1]} || $flds[1]; { my ($m, $d, $y) = split (m!/!, $flds[$DTE]); + #take date and strip "/" my $fq = int (($m + 6) % 12 / 3) % 4 + 1; # +get fiscal quarter my $fy = $y + ($m > 5 ? 1 : 0); #ge +t fiscal year $flds[$VIR] = sprintf "FY %04d Quarter %d", $fy, $fq; + #assign to virtual field } &test_break (); print "<tr valign=\"top\">\n"; foreach $spec (@$OUTPUT) { | | | } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Another Date related quest
by mitd (Curate) on Sep 11, 2001 at 00:42 UTC | |
by data67 (Monk) on Sep 11, 2001 at 00:54 UTC | |
|
Re: Another Date related quest
by derby (Abbot) on Sep 11, 2001 at 03:58 UTC |