commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Watkin <james.wat...@anderson.ucla.edu>
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
james.watkin@anderson.ucla.edu
Voice: 1-310-825-5030
   Fax: 1-310-825-4835
______________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message