combo question: date formats and general question about exceptions
posted 5 years ago
I'm writing a web app that uses dates, and in some cases I have the user enter dates in an html form and then I need to convert that input to a java date format...I usually use GregorianCalendar.
First...is that the best date format? Or is SimpleDateFormat better? I use GregorianCalendar mainly because the books and tutorials I came across when I was learning used it.
In my webapp stuff I'll usually have the user select values from a pulldown, and then have a method that converts it to a gregorianCalendar.
Which brings me to my 2nd question...
Does it make sense to write my own exception for an improper date? The method that converts the html form values to a calendar could then throw the exception, but is it considered overkill to put something that simple in a try/catch?