Stephen,

thank you for your patience, explaining to me. Slooooooooowly I get  
into Joda Time. I've found the base classes that I need to work with:

DateTime => a fixed date, such as "the meeting as at September 5th,  
2007 10:00 am"
Period => a "length" (not to say duration) for example "the meeting  
will take 2:00 hours"
LocalTime => a time independent from date or time zone, such as "we  
work from 9 to 5"

Moritz.


Am 23.08.2007 um 23:51 schrieb Stephen Colebourne:

> Moritz Petersen wrote:
>> But:
>>              System.out.println(new LocalTime(0));
>>
>> prints "01:00:00.000". Again that mysterious 1 hour? I thought that
>> LocalTime is time zone independent?
>
> LocalTime *is* time zone independent, but you are creating the  
> LocalTime
> using a constructor that is time zone aware (see the javadoc). To  
> create
> a LocalTime without any time zone impact, you can use new
> LocalTime(hour, min, sec, milli);
>
>
>> Your other tip worked very well:
>>
>>              DateTime start = DateTimeFormat.forPattern("dd.MM.yyyy
>> HH:mm").parseDateTime("21.08.2007 14:00");
>>              PeriodFormatter formatter = new PeriodFormatterBuilder 
>> ().appendHours
>> ().appendSeparator(":").appendMinutes().toFormatter();
>>              Period period = formatter.parsePeriod("4:00");
>>              DateTime end = start.plus(period);
>>              assertEquals(new DateTime(DateConverter.toMillis("21.08.2007
>> 18:00")), end);
>>
>> But something puzzles me: why is in the example above  
>> period.getMillis
>> () == 0 ?
>
> period.getMillis() returns the millisecond portion of the period. In
> this case, the hours portion is 4, the minutes portion is 0, the  
> seconds
> portion is 0 and the milliseconds portion is also 0.
>
> Stephen
>
>
> ---------------------------------------------------------------------- 
> ---
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a  
> browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Joda-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/joda-interest


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to