permaculture playing cards*
The moose likes Java in General and the fly likes Convert from String to java.sql.Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Convert from String to java.sql.Date" Watch "Convert from String to java.sql.Date" New topic
Author

Convert from String to java.sql.Date

satheesh krishnaswamy
Ranch Hand

Joined: Mar 17, 2004
Posts: 137
Hi everbody,
I have a doubt.I am having a field called mydate of type DATETIME in database in SQL SERVER 2000.From my jsp i call
date mydate=request.getParamater("mydate")
and try to insert into database by calling EJB Method addheader(---,mydate,--) .It is giving error.
Kindly give me solution as how to convert this string value received from request.getParameter() to java.sql.Date
The matter is most urgent.Kindly give me solution as soon as possible.
[ May 26, 2004: Message edited by: Bear Bibeault ]

Regards,<br /> <br />Satheesh.K<br />-------------<br />SCJP 1.4<br />SCWCD 1.4
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
what is the format of your date? I assume it is MM/dd/yyyy, You can do it as following:

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

Not a JSP or an EJB issue, so I've changed the title to something appropriate and moved to the Java in General(intermediate) forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Convert from String to java.sql.Date
 
Similar Threads
NumberFormatException
inserting a date field
How can I solve IllegalArgumentException
java.sql.date to string
util.Date to sql.Date