Well, using this particular example, all the toStandardXXX methods are
throwing exceptions because of the presence of years in the Period, as the
Javadocs state.  So is there a way around this, ie to convert a period of
months/years into minutes/hours etc?

Thanks,
- Elam

On Tue, Sep 30, 2008 at 10:36 AM, Matt Hughes <[EMAIL PROTECTED]> wrote:

> Because the getXXX methods just return that FIELD of time.  If you want the
> computed time, you need the toStandardXXX method.
>
> On Tue, Sep 30, 2008 at 9:41 AM, Elam Daly <[EMAIL PROTECTED]> wrote:
>
>> Hi all,
>>
>> I'm trying this simple example to understand the Period class.
>>
>> Why does the getDays() method return 0, instead of 472?
>>
>> Thanks,
>> - Elam
>>
>> DateTime start = new DateTime(2004, 12, 25, 0, 0, 0, 0);
>> DateTime end = new DateTime(2006, 1, 1, 0, 0, 0, 0);
>>
>> // period of 1 year and 7 days
>> Period period = new Period(start, end);
>> System.out.println(period.getDays()); // Returns 0
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Joda-interest mailing list
>> Joda-interest@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/joda-interest
>>
>>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to