This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I had to write a program for class to check and validate a date is correct. Check if year is between a certain range, check to make sure month is between 1 & 12. Then verify that there is the correct number of days in each month, along with check to see if it's a leap year or not for feb.
The if statements I wrote work but is there a way to clean this up a bit more or an alternative?
Then last part would be the toString. I still havent heard that if the date displays if it needs to be MM/DD/YYYY, or if it can be M/D/YYYY ex 02/02/2000 or 2/2/2000.
I know that using StringBuffer i can append, but how would I add the 0 before the day or month. I'm still tinkering with it, but not seeing any other solutions. I'm just going to assume that the date format needs to be 02/02/2000