• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

How to get weeks for a particular year with Calendar object

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to get weeks for a particular year with Calendar object? What I want is, starting from the first week of a particular year till the end, I need the start date of all the weeks considering Sunday as the first day. For eg. For year 2011 starting from month of January I need all the start dates of every week. 2 Jan 2011- 8 Jan -2011, 9 Jan 2011- 15 Jan 2011 etc.....

Kindly let me know if you have any solution to this...
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


would set the calendar to the Sunday of the week in question. Probably you can then add 7 to the calendar to get the rest of the sundays.

And Welcome to Javaranch.
 
Bhakti Sancheti
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sridhar.

But what I need is maybe an array of Dates/Objects that hold the values of all weeks for a particular year.
 
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using Sridhar's suggestion and Calendar's add() method you can generate the calendar objects you need and store them in the collection of your choice. Try coding it and come back if you need help.
 
Oh the stink of it! Smell my tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!