From: Stephen C. <sco...@jo...> - 2015-07-29 06:53:19
|
java.time does not contain every Joda-Time feature. Things like this can be simulated using multiple calls. See also java.time DateTimeFormatterBuilder, which has optionalStart() and optionalEnd(). These allow sections of the parse to be optional. This could simulate the format roughly using: yyyy-[DDD][-'W'ww-e][MM-dd] (with a zone like Europe/London where 'e' is day-of-week from Monday) This will parse the three formats, however it will also parse the combination "2015-001W02-301-01" It depends how strict you want to be. Stephen On 28 July 2015 at 18:52, costin <cos...@gm...> wrote: > This might not be the appropriate list however I'm hoping library experts can > chime in. > > I'm trying to migrate from Joda to Java 8 java.time package but that doesn't > seem possible. > I'm using Joda's ISODateTimeFormat.dateOptionalTimeParser but I can't seem > to find anything > similar in java.time. > The culprit seems to be that Joda allows multiple DateFormats to be chained > while this features > is not available in java.time. > As a concrete example, to quote Joda's dateOptionalTimeParser javadocs can > parse the date in three > different formats: std-date-element | ord-date-element | week-date-element > however java.time > allows only one. > > While with Joda DateTimeFormatterBuilder, one can append multiple parsers, > java.time allows only one. > > Am I missing something? > > Thanks, > > > > -- > View this message in context: http://joda-interest.219941.n2.nabble.com/coverting-Joda-dateOptionalTimeParser-to-java-time-tp7572605.html > Sent from the Joda-Interest mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > _______________________________________________ > Joda-interest mailing list > Jod...@li... > https://lists.sourceforge.net/lists/listinfo/joda-interest |