Reputation: 9
I insert date into database by the following code
String sql = "Insert Into Purchase (Purchase_ID, Purchase_Date) values (?,Date())";
and yes, my database store the value with the current date only
But when I retrieve the Purchase Date from my database into JTable, the result display the date when I insert and with the time 00:00:00:00.
How can I want to display the result with the date only?
Upvotes: 0
Views: 1221
Reputation: 2254
Use a SimpleDateFormat. For instance:
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
String s = format.format(yourDate);
Upvotes: 2