https://kotlinlang.org logo
Title
u

user

07/14/2022, 8:31 PM
I have to turn the date that comes from API to this format " starts in 10 days 23 h 34 m" from this format "2022-07-24T05:32:05.000000Z" I understand how to format in other forms but I don't know how to format in this way. @SuppressLint("SimpleDateFormat") fun String.toDateMixedString(from: String = "yyyy-MM-dd'T'hh🇲🇲ss.000000'Z'", to: String = "MM/dd/yyyy"): String { val date = this.toDate(from) val c = Calendar.getInstance() date?.let { c.time = it } val day = c.get(Calendar.DAY_OF_MONTH) val year = c.get(Calendar.YEAR) val monthText = c.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.US)...