Hi friend
Hope this helps you. String yourDate="date in mm/dd/yyyy format" (example: 08/22/2008) DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); ParsePosition pos = new ParsePosition (0); java.sql.Date wantedDate = new java.sql.Date(df.parse(yourDate,pos).getTime()); wantedDate is the variable of Date type. Example usage: In prepared statement: PreparedStatement ps=null; preparedStatement = con.prepareStatement("insert into table(date) values(?)"); ps.setDate(1,wantedDate); ps.executeQuery(); and import the necessary.(DateFormat and ParsePosition) Regards Nataraj Tata Consultancy Services No- 9985834848 -----Original Message----- From: Hardik Shah [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2008 4:02 PM To: user@struts.apache.org Subject: struts-hibernate-mysql date problem hi i am using hibernate 3 with s2 my problem is that im mysql table i have field of date type so i have set type date in hb mapping.xml and in pojo(if i am set as string in pojo and mapping file it gives error ) now i have to set date in input as format mm/dd/yy so mysql accepts it automatically and convert in its foramt type(YY-dd-mm) otherwise it return to input result but i want to show it as dd/mm/yy ,what i have to do for this any convertor of s2 apply or what? please help to solve this problem ----- Java/J2EE developer India blogs http://hardik4u.wordpress.com wordpress blog -- View this message in context: http://www.nabble.com/struts-hibernate-mysql-date-problem-tp19104863p191 04863.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ====================================== i-choose online store at www.tataindicom.com Your Comfort.Your Convenience.YourChoice. ====================================== DISCLAIMER: The information contained in this message (including any attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and permanently delete this message and any attachments from your system. Any dissemination, use, review, distribution, printing or copying of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change.TATATELESERVICES LTD. (including its group companies) shall not be liable for the improper or incomplete transmission of the information contained in this communication nor for any delay in its receipt or damage to your system. TATA TELESERVICES LTD. (or its group companies) does not guarantee that the integrity of this communication has been maintained nor that this communication is free of viruses, interceptions or interference. ====================================== i-choose online store at www.tataindicom.com Your Comfort.Your Convenience.YourChoice. ====================================== DISCLAIMER: The information contained in this message (including any attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and permanently delete this message and any attachments from your system. Any dissemination, use, review, distribution, printing or copying of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change.TATATELESERVICES LTD. (including its group companies) shall not be liable for the improper or incomplete transmission of the information contained in this communication nor for any delay in its receipt or damage to your system. TATA TELESERVICES LTD. (or its group companies) does not guarantee that the integrity of this communication has been maintained nor that this communication is free of viruses, interceptions or interference.