Suppose I have a week that begins with Sunday and ends with Saturday (so UMTWThFS). How do I get the date for each day of the week if, lets say, we use this month and year? I looked in the API but I wasn't sure what to extract to make it work.
degamer106 0 Junior Poster
Recommended Answers
Jump to PostCalendar a = new Calendar(); a.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); Date b = Calendar.getTime();
As an example. There's a bit more to it, depending on exactly what you want to do, but that's a start (and more than a start).
Jump to PostLook at the add method of Calendar (hint, you can give it negative numbers). Cycle backwards and use get(Calendar.DAY_OF_WEEK) and compare it to the GregorianCalendar method getFirstDayOfWeek().
All 5 Replies
masijade 1,351 Industrious Poster Team Colleague Featured Poster
degamer106 0 Junior Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster
degamer106 0 Junior Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.