No. The previous Tuesday to a Wednesday is the day before. By subtracting a week, you'll end up 8 days earllier.
I suggest writing a little unit test and experimenting to understand what the methods do if the javadoc isn't clear enough. Stephen On 21 September 2010 06:59, Jason Roscoe <jros...@riteaid.com> wrote: > Would this work (including if the previous Tuesday was in a previous month): > > DateTime previousTuesday = new DateTime().minusWeeks(1).withDayOfWeek(2); > > -----Original Message----- > From: Stephen Colebourne [mailto:scolebou...@joda.org] > Sent: Tuesday, September 21, 2010 9:56 AM > To: Discussion of the Joda project > Subject: Re: [Joda-interest] previous date > > LocalDate d = new LocalDate(2010, 9, 20); > while (d.getDayOfWeek() != DateTimeConstants.TUESDAY) { > d = d.minusDays(1); > } > > > On 21 September 2010 02:48, Jason Roscoe <jros...@riteaid.com> wrote: >> Could someone share some code example to do this? >> >> Thanks >> >> On Sep 21, 2010, at 1:25 AM, "Stephen Colebourne" <scolebou...@joda.org> >> wrote: >> >>> In Joda-Time you will need to loop backwards, calling minusDays(1) >>> each time around the loop, in order to find the day of week. >>> Stephen >>> >>> On 20 September 2010 12:51, Jason Roscoe <jros...@riteaid.com> wrote: >>>> I need to take the current date, and figure out the date for a previous >>>> day, >>>> for example Tuesday. So if today is Monday, Sept. 20, I need to return the >>>> previous Tuesday's date of September 14. How can I do this with joda time >>>> in the format yyyy-mm-dd (Ex.: 2010-09-14)? >>>> >>>> >>>> >>>> Thanks! >>>> >>>> ________________________________ >>>> Disclaimer: This e-mail message is intended only for the personal use of >>>> the recipient(s) named above. If you are not an intended recipient, you >>>> may not review, copy or distribute this message. If you have received this >>>> communication in error, please notify us immediately by e-mail and delete >>>> the original message. >>>> >>>> This e-mail expresses views only of the sender, which are not to be >>>> attributed to Rite Aid Corporation and may not be copied or distributed >>>> without this statement. >>>> >>>> ------------------------------------------------------------------------------ >>>> Start uncovering the many advantages of virtual appliances >>>> and start using them to simplify application deployment and >>>> accelerate your shift to cloud computing. >>>> http://p.sf.net/sfu/novell-sfdev2dev >>>> _______________________________________________ >>>> Joda-interest mailing list >>>> Joda-interest@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/joda-interest >>>> >>>> >>> >>> ------------------------------------------------------------------------------ >>> Start uncovering the many advantages of virtual appliances >>> and start using them to simplify application deployment and >>> accelerate your shift to cloud computing. >>> http://p.sf.net/sfu/novell-sfdev2dev >>> _______________________________________________ >>> Joda-interest mailing list >>> Joda-interest@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/joda-interest >> >> Disclaimer: This e-mail message is intended only for the personal use of >> the recipient(s) named above. If you are not an intended recipient, you >> may not review, copy or distribute this message. If you have received this >> communication in error, please notify us immediately by e-mail and delete >> the original message. >> >> This e-mail expresses views only of the sender, which are not to be >> attributed to Rite Aid Corporation and may not be copied or distributed >> without this statement. >> >> ------------------------------------------------------------------------------ >> Start uncovering the many advantages of virtual appliances >> and start using them to simplify application deployment and >> accelerate your shift to cloud computing. >> http://p.sf.net/sfu/novell-sfdev2dev >> _______________________________________________ >> Joda-interest mailing list >> Joda-interest@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/joda-interest >> > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Joda-interest mailing list > Joda-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/joda-interest > > Disclaimer: This e-mail message is intended only for the personal use of > the recipient(s) named above. If you are not an intended recipient, you > may not review, copy or distribute this message. If you have received this > communication in error, please notify us immediately by e-mail and delete > the original message. > > This e-mail expresses views only of the sender, which are not to be > attributed to Rite Aid Corporation and may not be copied or distributed > without this statement. > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Joda-interest mailing list > Joda-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/joda-interest > ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest