<Date format using kotlin> I would like to reforma...
# stackoverflow
u
Date format using kotlin I would like to reformat a string from 14 Sep 2021 to 14 Sep using the SimpleDateFormat or any other APIs. Currently my code looks like this: private fun convertToDayAndMonth(date: String): String{ val dateFormat: Date = SimpleDateFormat("dd MMM yyyy").parse(date)!! return SimpleDateFormat("d MMM").format(dateFormat) but i am getting an error that says "14 Sep 2021" cannot be parsed