Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Quarter Dates

by sflitman (Hermit)
on Jun 09, 2010 at 06:24 UTC ( #843815=note: print w/replies, xml ) Need Help??


in reply to Quarter Dates

Here is a solution:
. . . # Now loop for beginning qtr and ending qtr while (Date_to_Days(@x) < Date_to_Days(@y)) { my @qtr_end_date=Add_Delta_YMD(@x, 0,3,-1); my $diff=Date_to_Days(@qtr_end_date)-Date_to_Days(@e_dt); print "DIFF $diff\n"; if (abs($diff)<60) { @qtr_end_date=@e_dt; } printf("%4d-%02d-%02d\t%4d-%02d-%02d\t%sQ%01d\n", @x, @qtr_end_date, substr($x[0],2,2), $qtr); @x = Add_Delta_YMD(@x, 0,3,0); # roll over quarter to 1, beyond 4 $qtr++; $qtr = $qtr > 4 ? 1 : $qtr; } . . .
This is tested for your two cases. I am curious why you would want output which truncates the last quarter?

HTH,
SSF

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://843815]
help
Chatterbox?
[pryrt]: stevieb: going thru cblast to get caught up, I see that strawberry fixed their download hashes. Fast turnaround on that fix. :-)
[pryrt]: Are you going to tie the berrybrew expected hashes to their releases.json to keep it always up-to-date?

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2017-03-30 13:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (357 votes). Check out past polls.