I have the following code to get the last day of the month but what is strange is that returns 31 for the last day. On that month of the year there should be only 30 days. Therefore, when I tried to parse the string data, I get Caused by: java.text.ParseException: Unparseable date: "2020/6/31 00:00:00" Some tips or example will be lovely. I would love to hear from you!
val cal: Calendar = Calendar.getInstance().also {
it.clear()
it.set(Calendar.YEAR, 2020)
it.set(Calendar.MONTH, 6)
}
val lastDaysOfMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH)