Date d1 = new Date("Sat Feb 17 20:59:31 EST 1917"); Timestamp x = new Timestamp(d1.getTime());
Timestamp x = Timestamp.valueOf("17-02-1917 20:59:31");
    public void testDate() throws Exception    {        Connection c = getConnectionViaDriverManager();        try         {            Statement s = c.createStatement();            try             {                s.execute("CREATE TABLE DATETEST (DATEID INTEGER NOT NULL PRIMARY KEY, TESTDATE TIMESTAMP)");                PreparedStatement ps = c.prepareStatement("INSERT INTO DATETEST (DATEID, TESTDATE) VALUES (?,?)");                Calendar cal = new GregorianCalendar(timeZoneUTC);                Date d1 = new Date("Sat Feb 17 20:59:31 EST 1917");                Timestamp x = new Timestamp(d1.getTime());                try                 {                    ps.setInt(1, 1);                    ps.setTimestamp(2, x, cal);                    ps.execute();                }                finally                {                    ps.close();                } // end of finally                                try                 {                    ResultSet rs = s.executeQuery("SELECT TESTDATE FROM DATETEST WHERE DATEID=1");                    try                     {                                                 assertTrue("Should have one row!", rs.next());                        Timestamp x2 = rs.getTimestamp(1, cal);                        java.util.Date d2 = new java.util.Date(x2.getTime());                        assertTrue("Retrieved wrong value! expected: " + d1 + ", actual: " + d2, d1.equals(d2));                    }                    finally                    {                        rs.close();                    } // end of try-finally                }                finally                {                    s.execute("DROP TABLE DATETEST");                } // end of try-finally            }            finally            {                s.close();            } // end of try-catch        }        finally        {            c.close();        } // end of try-catch            }