Results 1 to 2 of 2
  1. #1
    Isong is offline Member
    Join Date
    Oct 2010
    Posts
    5
    Rep Power
    0

    Default Current dates in a week

    I have to write a program that prints this week of the year starting from Sunday on a window depending on the current date. I just don't know how to approach this. I tried using the add method from the Calendar API, but it doesn't work for every day.


    ex: this week

    31 | 1 | 2 | 3 | 4 | 5 | 6
    Last edited by Isong; 11-02-2010 at 01:05 AM.

  2. #2
    Michael Dunn is offline Member
    Join Date
    Jul 2008
    Posts
    62
    Rep Power
    0

    Default

    get a Calendar instance
    using calendar.add(), deduct the DAY_OF_WEEK, and add 1
    this'll set the calendar to Sunday
    in a loop, print the DATE, and add 1

Similar Threads

  1. Current week number method
    By levent in forum New To Java
    Replies: 2
    Last Post: 02-01-2010, 05:33 AM
  2. Manipulate dates by week
    By quiterin in forum Advanced Java
    Replies: 1
    Last Post: 09-21-2009, 04:30 PM
  3. Day of the Week Calculator
    By scheng12 in forum New To Java
    Replies: 0
    Last Post: 09-08-2009, 04:59 PM
  4. calendar with week numbers of a current month
    By sridharnr in forum Java Servlet
    Replies: 1
    Last Post: 03-27-2009, 12:02 PM
  5. Get dates of current week
    By Qlubbie in forum New To Java
    Replies: 2
    Last Post: 11-19-2008, 10:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •