aspose file tools*
The moose likes Servlets and the fly likes How can i get the first and the last date for a specific week Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How can i get the first and the last date for a specific week" Watch "How can i get the first and the last date for a specific week" New topic
Author

How can i get the first and the last date for a specific week

Rinku Sharma
Greenhorn

Joined: Mar 30, 2001
Posts: 18
Hi freinds,
i am making a calendar application and i am stuck with the weekly calendar module.Please tell me how do i get the first date and the last date for a perticular week.
bye,
amit
S Chandra Mohan
Ranch Hand

Joined: Oct 19, 2000
Posts: 75
Better u store a particular date as the root date.
And start calculating from that date as fixed.
Also take into consideration the LEAP years and others.
If u want more put ur reply here.
All the best

Have a wonderful day and wish u success<p>S Chandra Mohan<br />sc_mohan_us@yahoo.com
Akanimo Udoh
Ranch Hand

Joined: Jun 11, 2001
Posts: 48
Rinku,
I don't really think you'd want to attempt to rewrite the whole java date/calendar libraries! The easiest thing for you to do would be to use the java.util.Calendar (get an instance by calling the static Calendar.getInstance() method).
Calendar has a function Calendar.get(int) which can be used to get the day of week ( mon,tues,...) by using as getInstance(DAY_OF_WEEK). This factors in leap years etc so you don't have to worry about that. It would be very easy to write a function that accepts any date and produces the first and last day of that week by subtracting/adding the appropriate number of days based on the "day of week" obtained using the function above.
Akanimo.

[This message has been edited by Akanimo Udoh (edited July 10, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i get the first and the last date for a specific week