Wednesday 15 June 2011

java - Insert datetime to database -


  दिनांक वर्तमानडेटाइम; Java.sql.Date sql_currentDateTime; CurrentDateTime = getCurrentDateTime (); // शुक्र 21 जून 15:53:59 AZST 2013 sql_currentDateTime = नया जावा.sql.Date (currentDateTime.getTime ()); // 2013-06-21 तैयार किए गए स्थान पर insertStmt = null; SqlToMessage = "संदेश मानों में डालें (?)"; InsertStmt = conn.prepareStatement (sqlToMessage); InsertStmt.setDate (1, sql_currentDateTime); insertStmt.executeUpdate ();   

मैं डेटाबेस में वर्तमान दिनांक समय (20-Jun-13 16:04:32) डालना चाहता हूँ। लेकिन डाटा को डाटा संसाधित किया गया है, जैसे 20-Jun-13 , पसंद नहीं 20-Jun-13 16:04:32 । इसे कैसे हल करें? धन्यवाद यू

आपको java.sql.Timestamp के बजाय < कोड> java.sql.Date

java.sql.Timestamp की तिथि और समय है।

इसके अलावा, यह महत्वपूर्ण है कि तालिका का स्तंभ टाइमस्टैम्प है।

No comments:

Post a Comment