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)
======================================================================