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.
MySQL データベースに挿入するには、日付型をパラメータとして JSP からサーブレットに送信する必要があります。Date toDate = new java.sql.Date(format.parse(request.getParameter("to_date")).getTime()); を使用する場合 サーブレットでは、月の代わりに常に 01 が表示されます。日付を 2013-03-03 と入力していますが、2013-01-03 と表示されていました。
フォーマットをどのように定義しているかはわかりませんが、次のようにする必要があります。
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat コンストラクターの文字列は、大文字と小文字が区別されます。