Collision of Date format between java.sql and SQL Server
rameshmca rk
Greenhorn
Joined: Jan 27, 2007
Posts: 17
posted
0
Hi, I have a doubt about setting date format for database field when I use java.sql.Date format in my java applications.There is a collision between SQL Server's "month/day/year' format and java.sql.Date class' "year/month/day" format.If I tried to store "year/month/day" format in SQL Server table I got the error "Microsoft ODBC SQLException, Optional feature not implemented". How can I store that kind of date in SQL Server? Can I create american date format in java?How?
You are using ps.setDate(5,dtF5); which should be taking care of the date setting for you.
There isn't a different format for java.sql.Date in Java. It just represents a number of milliseconds. If you output the date value before setting it in the prepared statement, is it correct?