Dear sir
In my project i have to show amount of all the months i.e if user enter first due date and expiry date then it calculate the amount of all the months which are between first due date and expiry date in reports. in Jsp how a month can be added in a table date value.
if my filelds are :

java.sql.Date duedate=rs.getDate("firstrentduedate");
		 
java.sql.Date expirydate =rs.getDate("expiryofrent");
while(duedate .after(expirydate))
		  {
duedate=duedate+'addmonth'
}

plz help

Use Calendar and its add method.

but don't do it in a JSP.

Use Calendar and its add method.

Can You specify some code for it

Thanks

Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(field, amount);
c.getTime();

Read the API docs, they contain more than enough information for this sort of thing.

As mentioned, however, you should not be doing this in a JSP. Scriptlets have no place anymore in a JSP. They are only still allowed so as not to break old JSP (i.e. backwards compatability) but you should not be creating any new scriptlets. Use a Bean.

commented: Nice example as always +8
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.