LocalDate original = ...;
LocalDate firstOfMonth = original.withDayOfMonth(1);
LocalDate firstWed = firstOfMonth.withDayOfWeek(3);
if (firstWed.isBefore(firstOfMonth)) {
   firstWed = firsted.plusWeeks(1);
}
LocalDate thirdWed = firstWed.plusWeeks(2);


Stephen



Benoit Xhenseval wrote:
> Hi *,
> 
> I was wondering what the *best* way would be to, given a LocalDate, get 
> a new LocalDate (if required) that is the 3rd Wednesday of a given month?
> 
> eg
> LocalDate date = ....
> 
> // move the month
> date = date.monthOfYear().setCopy( month );
> 
> // move to the third Wednesday of that month
> ... suggestion?
> // what would be the best/fastest way?
> 
> 
> Thanks!
> 
> Benoit
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Joda-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/joda-interest

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to