File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

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

Joined: Jan 10, 2002
Posts: 63865

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] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Convert from String to java.sql.Date
It's not a secret anymore!