Hi, I once asked the same question. It was a problem that showed when switching from the standard Date/Calendar to Joda. The standard SimpleDateFormat can handle it, but the DateTimeFormatter can't. At that time there was no plan to change this behaviour. I solved it by creating two formatters and choose the correct one based on a check for a space at the specific index of the string.
Bart On 5/1/08, Lenny Wintfeld <[EMAIL PROTECTED]> wrote: > Hi > > I've got a date string to be input to Joda. The string has the > day-of-month left padded with a space for day-of -month smaller than > 10. I'd like to create a DateTimeFormatter capable of dealing with this > string. > > For instance January 10 2008 has a date string of "Jan 10 2008" (one > space between the month name and day-of-month) > but January 1 2008 has a date string of "Jan 1 2008" (two spaces > between month name and day-of- month. > > I've experimented with various DateTimeFormat format strings with > DateTimeFormatter dtf = DateTimeFormat.forPattern(<pattern goes here>) > but without success. > > I thought of creating 2 formatters, one for single digit months and one > for double digit months and running one of the formatter's > parseDateTime() methods inside the catch block of the illegal argument > exception generated by the other parser. But even if that works it seems > like a pretty clunky wat to do it. > > Is there a clean reliable way to solve this problem (hopefully with a > single DateTimeFormatter object?? > > Thanks in advance for your help. > > > Lenny Wintfeld > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Joda-interest mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/joda-interest > ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Joda-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/joda-interest
