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);