Switch to full style
What's behind JSP & Servlets
Post a reply

How To Increment Date In JSP?

Tue Jun 09, 2009 4:27 pm

hai,
I'm a beginner in jsp. I'm doing a miniproject in jsp for online film ticket reservation. In that i want to have a reservation facility for 5 days, that means an user can reserve from current date to 5 days. i get the current date displayed on a drop down list. Now i want 5 more days from current date to be displayed on the drop down list. if any one have the code/idea, plz help me....

thank u...



Re: How To Increment Date In JSP?

Wed Jun 10, 2009 6:52 am

this is a java code ,i didn't check it on jsp .

Code:

String DATE_FORMAT 
"yyyy-MM-dd";
java.text.SimpleDateFormat simpledataformat 
      new 
java.text.SimpleDateFormat(DATE_FORMAT);
Calendar c1 Calendar.getInstance(); 
c1.set(200720); // 2007 jan 20
System.out.println("Date is : " simpledataformat.format(c1.getTime()));
c1.add(Calendar.DATE,10);
System.out.println("After 10 days : " simpledataformat.format(c1.getTime()));
 


it is based on the calendar class.

another solution , i think you have to do a for loop . and every time increase the day of your date by +1 .

Re: How To Increment Date In JSP?

Fri Jun 12, 2009 2:54 am

Thank U. I got what i needed.

Post a reply
  Related Posts  to : How To Increment Date In JSP?
 Want start and end date of a month from current date     -  
 C++ Increment Operators     -  
 Formatting a Date with date()     -  
 get next date by next day     -  
 date validation in asp     -  
 Date in Java     -  
 String to sql.Date     -  
 date formatting in Java     -  
 Google indexing DATE     -  
 make class of date     -