If you're trying to format the date into a
String (in whatever format) so that you can insert it into a database table, in a column that is declared as DATE, then the best idea is to not do that. Use a PreparedStatement:
However if it's a text column (which also sounds like not such a good idea) or if you just need the date formatted so you can display it, then use a java.text.SimpleDateFormat object to do that.