Joda-time: new DateTime (String) vs DateTime.parse (String)

Using the joda-time-2.0 version library, I was wondering which of these functions is better to build from an ISO date (XML format xs:dateTime) : new DateTime(String)compared to DateTime.parse(String).

Because both return a different result from the same value. Example:

new DateTime("2012-08-16T07:22:05Z")
DateTime.parse("2012-08-16T07:22:05Z")

The result is different due to ISOChronology. At first it is said that the ISOChronology[Europe/Paris]second ISOChronology[UTC], although the milliseconds are the same.

It is also recommended here to use ISODateTimeFormat.dateTimeNoMillis(), giving the same result using the first version ( new).

+5
source share
1 answer

: InstantConverter, StringConverter , parse DateTimeFormatter, , .

ISO, , , , , . , , . , DateTime UTC:

new DateTime(DateTime.parse("2012-08-16T07:22:05Z"))
+12

All Articles