Hi Catalina, I have a servlet in which I connect through a mysql driver to the database. The servlet has a string that represents the date in the format 'MM/DD/YY'.
When I am trying to insert this date, I get sometimes the correct date, sometimes I get the '0000-00-00'. Here is the code: String sql_1 = "INSERT INTO bookmgr.copy (bookid, emp_purchaser, date_expensed, emp_holder) VALUES (?,?,?,?)"; ps = myConnection.prepareStatement(sql_1); // inserting records ps.setInt(1, bookid); ps.setInt(2, userId); ps.setString(3, expensed_date); ps.setInt(4, userId); ps.executeUpdate(); I understand that this particular date '0000-00-00' comes up when you have an invalid date. But I am checking that I get the correct date in the servlet from the jsp (which comes from a calendar) and again, sometimes it works, sometimes it doesn't. =Have I understood you correctly - that you are loading 'MM/DD/YY' dates into MySQL? =MySQL expects to see dates in [CC]YY-MM-DD format =See 6.2.2.2 The DATETIME, DATE, and TIMESTAMP Types =Do you need to re-format the date-data before INSERTing? =dn --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php