Hi,
Use the java.util.Calendar class instead of the Date class. It has methods
for incrementing by date, month or year.
For example you can give
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 5);
Hope it helps,
Nagaraj.
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Senaka Suriyaarachchi
Sent: Friday, December 22, 2000 9:16 AM
To: [EMAIL PROTECTED]
Subject: Java Date Class problem
Hi All
I tried to show drop down list with next 30 dates. but it doesn't work. It
correctly add up to 25 days after that it show previous days. Please advice
me.
BR
Senaka
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page language="java" import="java.sql.*, java.util.Date"%>
<jsp:useBean id="conn" class="ConnectLib" scope="session" />
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%
Date nd = new Date();
long lnd = nd.getTime();
Date todate = new Date(lnd);
String today = todate.toString();
java.sql.Date dbday = new java.sql.Date(lnd);
long lndnew = lnd;
%>
<form action="">
<table>
<tr>
<td colspan="3">Reservation Date</td>
<td><select name="reservDate">
<% for(int i=1; i<27; i++){%>
<option value="<%=(lndnew+ i*24*60*60*1000)%>"><%=
(new
java.sql.Date(lndnew + i*24*60*60*1000))%></option>
<% }%>
</select>
</td>
<td><input type="submit" name="reserv" value="Reserv"></td>
</tr>
</table>
</form>
</body>
</html>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets