I am trying to build a parser that will accept all of these formats (.msec is optional): hh:mm:ss.msec mm:ss.msec :ss.msec
I've got: new PeriodFormatterBuilder() .rejectSignedValues(true) .printZeroRarelyLast() .appendHours() .appendSeparator(":") .appendMinutes() .appendSeparatorIfFieldsAfter(":") .minimumPrintedDigits(2) .appendSecondsWithOptionalMillis() .toFormatter(); which generates the strings i want, but does not reciprocally parse strings starting with ":", eg: java.lang.IllegalArgumentException: Invalid format: ":00" at org.joda.time.format.PeriodFormatter.parseMutablePeriod(PeriodFormatter.java:326) at org.joda.time.format.PeriodFormatter.parsePeriod(PeriodFormatter.java:304) Is this a bug in Joda or in my formatter? If the former, are there any workarounds that would build a working parser without changing the output format? Also, the milliseconds always prints as 3 digits (unless it is zero, in which case the decimal point and millis are not printed at all, which is what i want). But is there a way to tell it to suppress trailing zeroes (eg: :00.01 instead of :00.010) ? thanks, daniel ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest