Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我通过以下代码将日期插入数据库
String sql = "Insert Into Purchase (Purchase_ID, Purchase_Date) values (?,Date())";
是的,我的数据库只存储当前日期的值
但是当我从我的数据库中将购买日期检索到 JTable 中时,结果会显示我插入的日期和时间 00:00:00:00。
我怎样才能只显示日期的结果?
使用 SimpleDateFormat。例如:
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); String s = format.format(yourDate);