I apologize for this noob-level question, but I'm angry at SimpleDateFormat and am wondering in anyone knows how to make it do what I want.
My issue is that I'm using SimpleDateFormat to basically validate different types of dates. This usually works fine, except with the terminating field of a date. For example, I parse the String "08/21/2007" against the format "MM/dd/yyyy" and confirm the date is valid.
My problem occurs when the user enters "bad" data for the year. If non-valid character are put in the month or date fields, they are handled with an error perfectly fine. However, if the user enters a letter somewhere in the year (say they use the letter O instead of a zero) SimpleDateFormat just views it as a terminating character. In short, the string "08/27/2OO7" (with letter O's) is parsed to "08/27/2" when it should be throwing an error. Is there any way to force SimpleDateFormat's parse to check the entire string?
I guess there is no way to force SimpleDateFormat to work your way, you'll have to adjust/rectify your code according to the way it works!
|All times are GMT +5.5. The time now is 08:05.|