Android CalendarView: How do I get the date in correct format?

前端 未结 4 861
我在风中等你
我在风中等你 2021-01-20 18:26

The past few days I\'ve been searching for ways to get a \'readable\' date out of my calendarview from android 4.0. I can\'t manage to find a solution or example that suits

4条回答
  •  伪装坚强ぢ
    2021-01-20 18:48

    You should use SimpleDateFormat

    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    String selectedDate = sdf.format(new Date(calendar.getDate()));
    

提交回复
热议问题