Removing time from a Date object?

前端 未结 19 1267
余生分开走
余生分开走 2020-12-15 02:26

I want to remove time from Date object.

DateFormat df;
String date;
df = new SimpleDateFormat(\"dd/MM/yyyy\");
d = eventList.get(0).getStartDate         


        
19条回答
  •  春和景丽
    2020-12-15 03:01

    Don't try to make it hard just follow a simple way

    date is a string where your date is saved

    String s2=date.substring(0,date.length()-11);
    

    now print the value of s2. it will reduce your string length and you will get only date part.

提交回复
热议问题