[My Blog]
All roads lead to JavaRanch
Christophe Verré wrote:Welcome to the ranch. Good start ! You should have a look at SimpleDateFormat too, if you are allowed to use it.
Why are you stuck by the day of the week ? Did you look at the Calendar API carefully ?
(your class name should start with an uppercase letter)
But for some reason its starting the week on a random day which is different for every month.
[My Blog]
All roads lead to JavaRanch
Christophe Verré wrote:
But for some reason its starting the week on a random day which is different for every month.
What do you mean ? If every month start with a different day, the result for Calendar.DAY_OF_WEEK will be different.
Christophe Verré wrote:Why are you using DAY_OF_WEEK_IN_MONTH ? DAY_OF_WEEK should do.
[My Blog]
All roads lead to JavaRanch
Christophe Verré wrote:The calendar month starts at 0, but you are setting newCal.set(y, m, d); with m being the month (starting from 1 I suppose). I think this is the reason why you are getting the wrong DAY_OF_WEEK.
Christophe Verré wrote:
even if i change the order to (m, d, y)
I was suggesting to set it to (y, m-1, d)
Can you tell me what are you application parameters, and which value does DAY_OF_WEEK return ?
[My Blog]
All roads lead to JavaRanch