Yes, currently this looks to be the best approach. I would recommend converting to DateMidnight using DateTimeZone.UTC.
tuesdays.isMatch(localDate.toDateTimeAtMidnight(DateTimeZone.UTC))); Stephen P.Hill & E. Goodall wrote: > Just thought I'd ask a simple question: > If I'm comparing a partial to a LocalDate is the quickest route > for the programmer and for execution is to convert to a DateTime using > localDate.toDateTimeAtMidnight() and then use partial.isMatch()? > > -Paul > > See JUnit code below. > > @Test > public void dayOfWeekCompareTest() { > > Partial tuesdays = new Partial( > new DateTimeFieldType[] {dayOfWeek()}, > new int[] {TUESDAY} > ); > LocalDate localDate; > localDate = new LocalDate(2007, 7, 17); // a Tuesday > > assertEquals(true, tuesdays.isMatch(localDate.toDateTimeAtMidnight())); > > localDate = new LocalDate(2007, 7, 17); // NOT a Tuesday > assertEquals(false, > tuesdays.isMatch(localDate.toDateTimeAtMidnight())); > } > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Joda-interest mailing list > Joda-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/joda-interest > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest