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.
重複の可能性: Formatクラスを使用した日付のフォーマット(またはそれ以外の場合)
「MySql」Dbを使用しています。DBテーブルにDateを「2012-04-30」形式で保存していますが、jspページにこの「04-Apr-2012」形式で表示する必要があります。
Javaコードでそれを行うにはどうすればよいですか?
Date d = (new SimpleDateFormat("yyyy-MM-dd").parse("2012-04-30")); String result = (new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH).format(d)); System.out.println(result);