Hi Stephen,

i tried:

System.out.println(formatter.print(duration.toPeriod().normalizedStandard()));

but it's the same, i tried also with serveral PeriodType on
normalizedStandard() but same results.


On 1 September 2011 11:38, Stephen Colebourne <scolebou...@joda.org> wrote:
> I haven't tried it, but I suspect that calling normalizedStandard() on
> the period before printing will do what you want.
> Stephen
>
> On 1 September 2011 10:29, fed <res...@gmail.com> wrote:
>> Hi,
>>
>> i have a negative Duration that indicates some hours/minutes, i want
>> to print it in the form hours:minutes,  i use this way for example:
>>
>>                DateTime start= new DateTime(2011, 1, 1, 15, 30 ,0 ,0);
>>
>>                DateTime end = new DateTime(2011, 1, 1, 0, 0, 0 ,0);
>>
>>                Duration duration = new Duration(start, end);
>>
>>                PeriodFormatter formatter = new PeriodFormatterBuilder()
>>                        
>> .minimumPrintedDigits(2).printZeroAlways().appendHours()
>>                        .appendSeparator(":").appendMinutes().toFormatter();
>>
>>                System.out.println(formatter.print(duration.toPeriod()));
>>
>> but in this case i get "-15:-30"  not "-15:30",   in the case that i
>> use as start  new DateTime(2011, 1, 1, 15, 0 ,0 ,0);   i get "-15:00"
>> and this is correct, no sign on the minutes.
>>
>> What is the right way to print this negative value in terms of hours:minutes 
>> ?
>>
>> Thanks for the help
>>
>> ------------------------------------------------------------------------------
>> Special Offer -- Download ArcSight Logger for FREE!
>> Finally, a world-class log management solution at an even better
>> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
>> download Logger. Secure your free ArcSight Logger TODAY!
>> http://p.sf.net/sfu/arcsisghtdev2dev
>> _______________________________________________
>> Joda-interest mailing list
>> Joda-interest@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/joda-interest
>>
>
> ------------------------------------------------------------------------------
> Special Offer -- Download ArcSight Logger for FREE!
> Finally, a world-class log management solution at an even better
> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> download Logger. Secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsisghtdev2dev
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to