Joda-Time has no direct way to handle the extra space (JSR-310 does). However, you can create a DateTimeFormatBuilder and use append(Printer, Parser[]) to add a selection of two parsers (one with an extra space and one without). The downside is that this would parse two spaces followed by two digits as well. http://joda-time.sourceforge.net/api-release/org/joda/time/format/DateTimeFormatterBuilder.html#append%28org.joda.time.format.DateTimePrinter,%20org.joda.time.format.DateTimeParser[]%29
You can also implement your own DateTimeParser that handles a possibly space prefixed day-of-month. Again, use DateTimeFormatBuilder to integrate. Stephen On 6 May 2011 19:47, Hiller, Dean (Contractor) <dean.hil...@broadridge.com> wrote: > We have an incoming date of > > > > Dec 1 2000 > > > > And > > > > Dec 12 2000 > > > > This is from an external system. The format of the date is “<space>1” or > “12” in the cases above so there is two spaces after Dec in the first > example and only 1 space in the second example. When using the format “MMM > d yyyy”, it failes on Dec 1 2000 because of the extra space. Is there any > way to deal with that optional space there? > > > > Thanks, > > Dean > > This message and any attachments are intended only for the use of the > addressee and > may contain information that is privileged and confidential. If the reader > of the > message is not the intended recipient or an authorized representative of the > intended recipient, you are hereby notified that any dissemination of this > communication is strictly prohibited. If you have received this > communication in > error, please notify us immediately by e-mail and delete the message and any > attachments from your system. > > > ------------------------------------------------------------------------------ > WhatsUp Gold - Download Free Network Management Software > The most intuitive, comprehensive, and cost-effective network > management toolset available today. Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd > _______________________________________________ > Joda-interest mailing list > Joda-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/joda-interest > > ------------------------------------------------------------------------------ WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest