Hi,
Looks like... ur input is in yyyy-mm-dd ( note '-' )
When u r parsing using SimpleDateFormat, ur giving the pattern as 'dd mm
yyyy', which is not the same.
Try changing it it 'yyyy-mm-dd'.
HTH
Sudhi

> All:
>
> Here is the code to convert String date to java.sql.Date in
> jsp, anybody
> would help to find what's wrong here.
> the first output is: 2001-04-02,
> the second converted putput is null.
>
> I need the second converted date to be avaible in my
> preparedstatement.setDate field.
>
> Thanks,
>
> Carol
>
> =============================
>
>   mybcdate = request.getParameter("bcdate");
>     out.println("the string date is: " + mybcdate);
>     SimpleDateFormat dateFormatter = new SimpleDateFormat("dd
> MM yyyy");
>
>     try {
>     lbcdate = new java.sql.Date(
> dateFormatter.parse(mybcdate).getTime() );
>
>     }catch (java.text.ParseException e) {}
>     out.println ("the date is: " + lbcdate);
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to