Neil.Martin wrote:
> DateTime dt1, dt2;
> LocalDateTime ldt1, ldt2, ldt3;
>
> dt1 = new DateTime(2007, 12, 31, 12, 0, 0, 0,
> DateTimeZone.forID("Etc/GMT+0"));
> dt2 = new DateTime(2007, 12, 31, 10, 0, 0, 0,
> DateTimeZone.forID("Etc/GMT+2"));
> assertEquals(dt1.getMillis(), dt2.getMillis());
> // although assertEquals(dt1, dt2); fails(?), when I originally expected
> it to pass.
.equals() on DateTime compares the instant, chronology and time zone id.
In this case, the time zone is different.
> One thing I still find a bit confusing is the following statement from
> the API javadocs for LocalDateTime:
> "Internally, LocalDateTime holds the datetime as milliseconds from
> 1970-01-01T00:00:00. This represents the local millisecond count which
> differs from the epoch-based millisecond value in a ReadableInstant
> implementation by the amount of the zone offset."
> First of all, it is ambiguous what the "1970-01-01T00:00:00" refers to -
> is it in UTC or in the local time zone? Secondly, it appears to suggest
> that LocalDateTime contains a millisecond count, yet there is no
> LocalDateTime.getMillis() and LocalDateTime is a Partial not an Instant
> so I don't understand why it would have a millisecond count at all.
The epoch is a 'local' epoch, and there is no getMillis() as this is
merely used as an efficient internal representation.
> It might be less confusing if the paragraph in the LocalDateTime
> javadocs that mentions the millisecond count were just dropped. It
> seems like it is a bit of a red herring. It also might help to link the
> javadocs for LocalDate, LocalTime, LocalDateTime, DateTime back to the
> user documentation for Partial and Instant.
I've updated the relevant javadoc.
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