| | |
Add month in date
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2007
Posts: 11
Reputation:
Solved Threads: 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 :
plz help
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 Syntax (Toggle Plain Text)
java.sql.Date duedate=rs.getDate("firstrentduedate"); java.sql.Date expirydate =rs.getDate("expiryofrent"); while(duedate .after(expirydate)) { duedate=duedate+'addmonth' }
Last edited by peter_budo; May 27th, 2008 at 9:46 am. Reason: Keep It Organized - please use [code] tags
Use Calendar and its add method.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
JSP Syntax (Toggle Plain Text)
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.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
![]() |
Similar Threads
- Starting Python (Python)
- Java date program (Java)
- C++ Date Class (C++)
- please help! (C++)
- Access Date Problem (Computer Science)
- I lack focus... (Java)
- embedded date formula for VB or Access (Visual Basic 4 / 5 / 6)
- how many days in each month? (IT Professionals' Lounge)
- Need help With this C++ Program..Confused.. (C++)
- greeting everyone, a little help? thanks. (C++)
Other Threads in the JSP Forum
- Previous Thread: how to create a pdf file in servlet
- Next Thread: Please help with JSP mysql update query
Views: 1965 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for JSP
apache array backbutton combobox comma connection csv database development directorystructure dropdownlist dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 mysql netbeans network parameters passing ping printinserverinsteadofclient project read redirect request.getparameter response seperated servlet servletdopost()readxml sessions software sql ssl state_saving_method stocks sun tomcat tutorial update values video web write






