This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Am having a calendar control for my page where am getting date in dd/mm/yyyy format which is taken as a string.
And am converting that string to DateFormat and then to Calendar. Below is the code which I have used
1) I need a logic in such a way that if I select a date it has to check the day and if its not monday it has to get the Monday of that particular week.
For example like if he selected "26/8/2009" the day will be Wednesday, I need a logic where it gives "24/8/2009" as it is monday of that particular week.
2) And next is after getting "24/8/2009" , I need one more logic like it has to get date of next four weeks that is "21/9/2009"
If the initial date is a SUNDAY, for example "30/8/2009", this will return 31/8/2009. Not sure if that is what is expected. If 24/8/2009 is the desired result, a bit complicated logic can be written.
Sebastian Janisch
Ranch Hand
Joined: Feb 23, 2009
Posts: 1183
posted
0
This is because the US week starts on sunday.
You could change this by passing a locale with a country that's week starts on Monday, such as Germany.
Calendar cal = Calendar.getInstance(new Locale("DE"));