Q123Q
Q123Q

Reputation: 9

How to display date in Jtable with the date value only?

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

Answers (1)

mael
mael

Reputation: 2254

Use a SimpleDateFormat. For instance:

SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
String s = format.format(yourDate);

Upvotes: 2

Related Questions