Hi
i am using a popup calendar for my project which is in dd/mm/yyyy format and mysql database has the date format as yyyy-mm-dd, my issue is that when i insert date in the database following exception occurs :

Exception foundcom.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect date value: '29/12/2010' for column 'DateOfJourney' at row 1

Please help me.. it's urgent!

thanks in advance

Recommended Answers

All 2 Replies

The format doesn't matter. It is used only for the presentation. As long as you have the date as a Date object there shouldn't be a problem. But if you have the date as a String, then you cannot insert it in the database if the column has Date type.

So what type is the column at the database declared?
What code do you use to insert the date.

or
After getting date from calender in dd/mm/yyyy format , change this format to yyyy-mm-dd. it is not so difficult..
and then write it in your sql query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.