posted 19 years ago
Date objects (whether it's java.util.Date or java.sql.Date) do not have a format. When you convert a Date object to a string by calling toString() on it, the date is formatted with a certain default format.
If you want to have your Date object formatted differently, use java.text.SimpleDateFormat to format it. Because java.sql.Date is a subclass of java.util.Date, you can pass java.sql.Date to the SimpleDateFormatter without converting anything. Example: