ncsvietnam
asked on
Problem when convert string to date (invalid day of Feb)
Hi experts!
I met a problem when convert a string to date. Pls help, many thanks!
When input string represents a date with February month, invalid day of month (29 or 30, 31,..), it's automatically converted to March and day of month is (invalid input day of month - 28 (or 29)).
For example, input string "31/2/2009" will be converted to "3/3/2009"
I met a problem when convert a string to date. Pls help, many thanks!
When input string represents a date with February month, invalid day of month (29 or 30, 31,..), it's automatically converted to March and day of month is (invalid input day of month - 28 (or 29)).
For example, input string "31/2/2009" will be converted to "3/3/2009"
SimpleDateFormat ts= new SimpleDateFormat("dd/MM/yyyy");
ava.sql.Date retDate = new java.sql.Date(ts.parse(inpCell.getContents()).getTime());
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.