DateFormat does not work?

前端 未结 4 1917
难免孤独
难免孤独 2021-01-22 08:49
String selectedDate = \"2012-\" + createdMonth + \"-\" + createdDay;

SimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd\");

try {
    createdDate = dateFo         


        
4条回答
  •  囚心锁ツ
    2021-01-22 09:14

    You need to print as below. Point is that you need to use the formatter object you have created while printing as well.

    System.out.println(dateFormat.format(createdDate));
    

提交回复
热议问题