This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
My code started working when i removed the formatter
But i have a question. Calender functionality takes the system date and converts it into a desired format. In case someone alters the system date then program will not give desired results. What can be done so that it takes date , say from internet server or some other place. What changes we need to make to the above code
The code worked because the format specified in the SimpleDateFormat didnt support Timezone information. You need to add "z" at the end of the string passed to SimpleDateFormat for timezone information to be shown.
Please start a new thread for a new question. (There should be some API available, not sure if its in JDK, to get the correct time from the Internet).