When you construct it, pass in the PeriodType parameter. Stephen On 22 August 2011 05:01, Yohan Yudanara <yohan.yudan...@gmail.com> wrote: > hmm.. I also looking for an answer. :) > Hopefully someone on this list can answer that question. > > On Mon, Aug 22, 2011 at 10:56 AM, Lowell Kirsh <lowe...@gmail.com> wrote: >> >> Ah, that makes sense. Is there a way to get the number I'm looking for? >> That is, 15 in this case? >> >> On Sun, Aug 21, 2011 at 8:50 PM, Yohan Yudanara <yohan.yudan...@gmail.com> >> wrote: >>> >>> I think that's because 15 days is: 2 weeks 1 day. >>> So getDays() will return 1, and getWeeks will return 2. >>> CMIIW... >>> On Mon, Aug 22, 2011 at 10:28 AM, Lowell Kirsh <lowe...@gmail.com> wrote: >>>> >>>> I'm new to joda an am seeing surprising behavior. I have created a >>>> Period from 2 DateTimes, one which is 15 days ago and one which is now. >>>> Looking at their toString() values, they look like they have been >>>> constructed properly. However, Period(then, now).getDays() returns 1. Am I >>>> doing something wrong? >>>> code: >>>> @Test >>>> public void testJodaTime() { >>>> DateTime then = new DateTime(System.currentTimeMillis() - 15L * >>>> 24L * 60L * 60L * 1000L); // 15 days ago >>>> DateTime now = new DateTime(); >>>> Period period = new Period(then, now); >>>> System.out.println(then); >>>> System.out.println(now); >>>> System.out.println(period.getDays()); >>>> } >>>> >>>> output: >>>> 2011-08-06T20:23:16.307-07:00 >>>> 2011-08-21T20:23:16.344-07:00 >>>> 1 >>>> Thanks! >>>> Lowell >>>> >>>> ------------------------------------------------------------------------------ >>>> uberSVN's rich system and user administration capabilities and model >>>> configuration take the hassle out of deploying and managing Subversion >>>> and >>>> the tools developers use with it. Learn more about uberSVN and get a >>>> free >>>> download at: http://p.sf.net/sfu/wandisco-dev2dev >>>> >>>> _______________________________________________ >>>> Joda-interest mailing list >>>> Joda-interest@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/joda-interest >>>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> uberSVN's rich system and user administration capabilities and model >>> configuration take the hassle out of deploying and managing Subversion >>> and >>> the tools developers use with it. Learn more about uberSVN and get a free >>> download at: http://p.sf.net/sfu/wandisco-dev2dev >>> >>> _______________________________________________ >>> Joda-interest mailing list >>> Joda-interest@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/joda-interest >>> >> >> >> >> -- >> http://lowellkirsh.com >> >> >> >> ------------------------------------------------------------------------------ >> uberSVN's rich system and user administration capabilities and model >> configuration take the hassle out of deploying and managing Subversion and >> the tools developers use with it. Learn more about uberSVN and get a free >> download at: http://p.sf.net/sfu/wandisco-dev2dev >> >> _______________________________________________ >> Joda-interest mailing list >> Joda-interest@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/joda-interest >> > > > ------------------------------------------------------------------------------ > uberSVN's rich system and user administration capabilities and model > configuration take the hassle out of deploying and managing Subversion and > the tools developers use with it. Learn more about uberSVN and get a free > download at: http://p.sf.net/sfu/wandisco-dev2dev > > _______________________________________________ > Joda-interest mailing list > Joda-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/joda-interest > >
------------------------------------------------------------------------------ uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest