• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic