To be strict, you need to use the builder and call appendDecimal. It gives
control over the min and max number of digits that can be parsed.
On 8/20/07, Ryan Propper <[EMAIL PROTECTED]> wrote:
>
> But neither of these seems to be strict either:
>
> public static final DateTimeFormatter formatWithoutMillis =
> new DateTimeFormatterBuilder()
> .appendYear(4, 4)
> .appendLiteral('-')
> .appendMonthOfYear(2)
> .appendLiteral('-')
> .appendDayOfMonth(2)
> .appendLiteral('T')
> .appendHourOfDay(2)
> .appendLiteral(':')
> .appendMinuteOfHour(2)
> .appendLiteral(':')
> .appendSecondOfMinute(2)
> .appendLiteral('Z')
> .toFormatter();
>
> or:
>
> public static final DateTimeFormatter formatWithoutMillis =
> DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
>
> On 8/20/07, Brian O'Neill <[EMAIL PROTECTED]> wrote:
> > The parsers in ISODateTimeFormat are lenient and don't require leading
> > zeros. If you want a strict parser, build one using
> > DateTimeFormatterBuilder.
> >
> >
> > On 8/20/07, Ryan Propper <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > >
> > > Why isn't this line:
> > >
> > >
> > ISODateTimeFormat.dateTimeNoMillis
> ().parseDateTime("2000-10-1T1:32:32Z");
> > >
> > > throwing an exception? Note that the day of month and hour only have
> > > one digit, not two.
> > >
> > > Thanks,
> > >
> > > Ryan
> > >
> > >
> >
> -------------------------------------------------------------------------
> > > This SF.net email is sponsored by: Splunk Inc.
> > > Still grepping through log files to find problems? Stop.
> > > Now Search log events and configuration files using AJAX and a
> browser.
> > > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > > _______________________________________________
> > > Joda-interest mailing list
> > > [email protected]
> > >
> > https://lists.sourceforge.net/lists/listinfo/joda-interest
> > >
> >
> >
> >
> -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Joda-interest mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/joda-interest
> >
> >
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Joda-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest