Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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';

Replies are listed 'Best First'.
Re^2: Split date range into 3 equal parts
by sundialsvc4 (Abbot) 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://942367]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2018-02-19 00:45 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (257 votes). Check out past polls.