commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C. Scott Ananian" <csc...@cscott.net>
Subject Re: [lang] Enhancement proposal for DateUtils
Date Sat, 11 Sep 2004 18:33:28 GMT
On Sat, 11 Sep 2004, Sean Schofield wrote:

> adjustForWeekends(Date):Date

> a weekend, the managers want to know and plan accordingly.  The
> adjustForWeekends method will move the original date backwards until it is
> no longer a weekend.

I would think that, in general, you would want the ability to adjust dates
either forward or backward for weekends.  I.e. "1st weekday of the month"
or "last weekday of the month".  "15th of the month, adjusted" might go
either way.

Probably two methods, "adjustForwardToWeekday()" and
"adjustBackwardToWeekday", although alternately "nextWeekday" and
"previousWeekday" could work, with
  Date adjustForwardToWeekday(Date d) {
    Date n = d.nextWeekday();
    return n.previousWeekday().equals(d) ? d : n;
  }
etc.
 --scott

Panama Sugar Grove Yakima KUPALM supercomputer ODYOKE AEFOXTROT Mossad
   Register to vote!  http://www.yourvotematters.org/VerifiedVoting
                         ( http://cscott.net/ )

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message