Hello there, the DateTimeFormatter does not seem to be able to parse its own output in Joda 1.6.2. Example:
Date date = new Date(); DateTimeFormatter fmt = DateTimeFormat.forPattern( "E MM dd HH:mm:ss z yyyy" ); DateTime dt = new DateTime( date ); String result = fmt.withLocale( Locale.US ).print( dt ); will yield "Sat 07 30 10:19:04 CEST 2011" on my machine (JDK 1.6, default Locale German). However, feeding back that result into the DateTimeFormatter to parse: DateTimeFormatter fmt = DateTimeFormat.forPattern( "E MM dd HH:mm:ss z yyyy" ); DateTime dt = fmt.withLocale( Locale.US ).parseDateTime( "Sat 07 30 10:19:04 CEST 2011"); Date date = dt.toDate(); will lead to java.lang.IllegalArgumentException: Invalid format: "Sat 07 30 10:19:04 CEST 2011" is malformed at "CEST 2011" I note that "CEST" is not part of the array returned by java.util.TimeZone.getAvailableIDs(). However, the corresponding JDK code will still work OK: DateFormat df = new SimpleDateFormat( "E MM dd HH:mm:ss z yyyy", Locale.US ); Date date = df.parse( "Sat 07 30 10:19:04 CEST 2011" ); Am I overlooking something or is this really a bug? -- Sebastian ------------------------------------------------------------------------------ Got Input? Slashdot Needs You. Take our quick survey online. Come on, we don't ask for help often. Plus, you'll get a chance to win $100 to spend on ThinkGeek. http://p.sf.net/sfu/slashdot-survey _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest