Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Split date range into 3 equal parts

by Khen1950fx (Canon)
on Dec 08, 2011 at 06:59 UTC ( #942367=note: print w/ replies, xml ) Need Help??


in reply to Split date range into 3 equal parts

Class::Date makes it a lot quicker.

#!/usr/bin/perl -slw use strict; use warnings; use Class::Date qw(date); my $date = new Class::Date; print "from_date: ", date("2010-06-01"); print "mid_date1: ", date("2010-06-01") + '3M' + '1D ' - '1D'; print "mid_date2: ", date("2010-06-01") + '3M' + '1D'; print "to_date: ", date("2010-06-01") + '7M';


Comment on Re: Split date range into 3 equal parts
Download Code
Re^2: Split date range into 3 equal parts
by sundialsvc4 (Monsignor) on Dec 08, 2011 at 22:22 UTC

    I “fanned” that approach, because, in my humble experience, when you start down the primrose-path of date calculations (in terms of what employees such as salesmen and accountants want to do with them ...), it just gets messier and messier.   But, because so darned many of us have been down that very same primrose-path so many times before, “all the work that went into” modules like this one are darned well worth it.   The client comes back to you with a new twist and you can still say, a la “A Chorus Line” ... “I can do that.”   Priceless.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2014-07-30 01:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls