display Java.util.Date in a specific format

后端 未结 10 1905
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 08:56

I have the following scenario :

SimpleDateFormat dateFormat = new SimpleDateFormat(\"dd/MM/yyyy\");
System.out.println(dateFormat.parse(\"31/05/2011\"));
         


        
10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 09:14

    You can use simple date format in Java using the code below

    SimpleDateFormat simpledatafo = new SimpleDateFormat("dd/MM/yyyy");
    Date newDate = new Date();
    String expectedDate= simpledatafo.format(newDate);
    

提交回复
热议问题