0

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

3
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by masijade
0

Use Calendar and its add method.

Can You specify some code for it

Thanks

1
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.

Votes + Comments
Nice example as always
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.