12 Replies Latest reply on May 22, 2008 6:20 AM by 807591

    cast a Strring to to Date data type ??

      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.