Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4514831

GregorianCalendar, can't roll date from 10/28/2001 to 10/29/2001

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.1
    • 1.3.1
    • core-libs
    • hopper
    • x86
    • windows_98



      Name: bsT130419 Date: 10/15/2001

      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
      Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)


      Hi, I'm using the GregorianCalendar class from the jav.util package and have
      had a small problem. When I run the code below, the calendar doesn't seem to
      want to roll the date from 10/28/2001 to the next day. The code however works
      for any other starting date except 10/28/2001. The output of the code is:
      "28-28 28-29 29-30 30-31 31-1 1-2 2-3"

      import java.io.*;
      import java.util.*;

      import javax.servlet.http.*;
      import javax.servlet.ServletOutputStream;
      import javax.servlet.ServletException;

      public class test extends HttpServlet
      {
      public void doGet(HttpServletRequest request, HttpServletResponse
      response) throws ServletException, IOException
      {
                     GregorianCalendar c = new GegorianCalendar(2001,9,28);

                      String test="";
      for(int i=0; i<7; i++)
      {
      test+=c.get(c.DAY_OF_MONTH) + "-";
      c.roll(c.DAY_OF_YEAR, true);
      test+=c.get(c.DAY_OF_MONTH) + "";

      test += " ";
      }
      PrintWriter out = response.getWriter();
      response.setContentType("text/html");
      out.print(test);
      }
      }


      Thanks for any help.

      Dan
      (Review ID: 133716)
      ======================================================================

            peytoia Yuka Kamiya (Inactive)
            bstrathesunw Bill Strathearn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: