commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Watkin <>
Subject org.apache.commons.lang.time.DateUtils.parseDate Leniency
Date Tue, 09 Oct 2007 23:57:24 GMT
org.apache.commons.lang.time.DateUtils.parseDate appears to use 
SimpleDateFormat to do its parsing with setLenient(true). This will 
result in the acceptance of a date string like "20012007" against a 
pattern like "MMddyyyy". This parsing will actually return a date of Fri 
Aug 01 00:00:00 PDT 2008.

A suggestion for a future enhancement might be to create an additional 
method for DateUtils named parseStrictDate, or something similar, which 
applies setLenient(false) to its internal SimpleDateFormat parser.

- Jim
James Watkin
ACIS Software Development
UCLA Anderson School
Voice: 1-310-825-5030
   Fax: 1-310-825-4835

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message