I was wondering the same thing just yesterday.

On Fri, Dec 19, 2008 at 7:02 AM, Mark Volkmann <[email protected]> wrote:

>         LocalDate ld = new LocalDate(year, 11, 1);
>         if (ld.getDayOfWeek() != DateTimeConstants.THURSDAY) {


At this point, 'd.plusDays(THURSDAY - d.getDayOfWeek() + 7) % 7)' should get
you straight to the first Thursday, right?  I don't know what's the best
way, though.  I also couldn't find an explanation of what .withDayOfWeek()
does -- does it always move backward?

K




>             // Move back to the previous Thursday.
>             ld = ld.withDayOfWeek(DateTimeConstants.THURSDAY);
>
>             if (ld.monthOfYear().get() != DateTimeConstants.NOVEMBER) {
>                 ld = ld.plusWeeks(1); // move forward into November
>             }
>         }
>
>         return ld.plusWeeks(3); // to get to 4th Thursday
>     }
> }
>
>         // Now call that method like this.
>         LocalDate thanksgiving = getThanksgiving(year);
>         if (thanksgiving.isBefore(today)) {
>             thanksgiving = getThanksgiving(year + 1);
>         }
>
> ---
> Mark Volkmann
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Joda-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>



-- 
Kevin Bourrillion @ Google
internal:  http://go/javalibraries
google-collections.googlecode.com
google-guice.googlecode.com
------------------------------------------------------------------------------
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to