12 Replies Latest reply: May 22, 2008 12:38 AM by 807591 RSS

    cast a Strring to to Date data type ??

    807591
      Hi,
      I want to cast the date which is in string data type in to Date data type . Below is the code which I wrote.
      SimpleDateFormat formater=new SimpleDateFormat("dd/MM/yyyy");
       String sDate=request.getParameter("date"); // retrive the date from jsp .
       Date date=(Date)formater.parse(sDate);
      String SQL_QUERY="from QuesClass where createdDate ='"+date+"'"; // the query.
      when I run the code it throws an NullPointerException. Can any one help me.
      Thanks in advance.