• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can someone tell me how I can set the first day of the year in the Java Calender?  RSS feed

 
Sobia Mill
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All.

Can someone tell me how I can set the first day of the year in the Java Calender?

For example, if the first day of the year was 16th September 2007, then that would be week 1.
so the 24th September 2007 would lie in second week,so on.

please reply ASAP


 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please ease up
Also, please check your private messages for an important administrative matter
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default Calendar classes do not support this. You can tweak the first day of the week, and the minimum number of days a week must have, but in the end week 1 will still fall in January. The only thing I can think of is use the backing weeks, then recalculate with the week of that particular date. You can use Calendar.getActualMaximum to retrieve the number of weeks in the current year.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Sobia Sobia"
Please check your private messages one more time.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!