1 Reply Latest reply: Dec 19, 2006 2:07 PM by 807607 RSS

    Converting java.util.date to sql.date

    807607
      I am trying to insert a date into a database using a prepared statement but when i do so with
      prepStmt.setDate(3,contact.getDob());
      but I get an error because it isn't a java.sql.date

      When trying to convert using
      java.sql.Date sqlRegTime = new java.sql.Date(contact.getDob());
      I get an error saying that it cannot find symbol,

      symbol : constructor Date(java.util.Date)
      location: class java.sql.Date
      java.sql.Date sqlRegTime = new java.sql.Date(patient.getDob());

      I don't full understand the syntax of converting from util.date to sql.date so probably where my issue is.

      thanks