I am trying to convert a timestamp to a day of the week.
The goal would be to translate to something like ts -> MON or TUE ....
I have tried the code below but it's not working.
fun convertToReadableDate(timestamp: Long): String {
val formatter = SimpleDateFormat("dd-mm-yyyy")
val cal = Calendar.getInstance(Locale.ENGLISH)
cal.timeInMillis = timestamp * 1000
val date: LocalDate = LocalDate.parse(formatter.format(cal.time))
return date.dayOfWeek.toString()
}
Any idea ? Thanks