Created
February 17, 2022 08:56
-
-
Save jonrysimbolon/76eb36b8131b8b29f74535650e7ab01f to your computer and use it in GitHub Desktop.
Change day to indonesian day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun changeDate(date: String): String { | |
//val myFormat = "EEEE, dd-MM-yyyy" | |
val dateKom = date.split(", ") | |
val dayStr = dateKom[0] | |
val dateStr = dateKom[1] | |
var showDayDate = "" | |
when (dayStr) { | |
"Monday" -> { | |
showDayDate = "Senin, $dateStr" | |
} | |
"Tuesday" -> { | |
showDayDate = "Selasa, $dateStr" | |
} | |
"Wednesday" -> { | |
showDayDate = "Rabu, $dateStr" | |
} | |
"Thursday" -> { | |
showDayDate = "Kamis, $dateStr" | |
} | |
"Friday" -> { | |
showDayDate = "Jumat, $dateStr" | |
} | |
"Saturday" -> { | |
showDayDate = "Sabtu, $dateStr" | |
} | |
"Sunday" -> { | |
showDayDate = "Minggu, $dateStr" | |
} | |
} | |
return showDayDate | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment