Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java

 
bhawna
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to subtract date from date in java programming?
How to call a servlet through a servlet?
 
Nikhil Chavan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Answers for your query is given below.
1> You can not conver date into date. For this you have get convert in to seconds, minutes, days, month or Year. And then you can minus the converted format.
For coversion of the date you can use date or dateFormat.
2> Calling a servlet page from another servlet is called redirection of a page. Here you can write code directly in to servlet. For this purpose you have to include HTML page in servlet or use redirect() method.
I hope your query is solved. For reference pl. use "SERVLET" book by "oreirly" publication.
Regards
Nikhil
nikhilrc@usa.net
------------------

[This message has been edited by Nikhil Chavan (edited February 09, 2001).]
[This message has been edited by Nikhil Chavan (edited February 09, 2001).]
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) There's a couple of ways to do this. You can use the getTime() method which returns the Date object as a long. Do your arithmetic and use the result to create a new Date object. Or you can convert your Date objects to Calendar objects and use the add() method.
2) Use the RequestDispatcher interface. It has forward() and include() methods specifically for this purpose.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"bhawna",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic