Answers for "kotlin local time"

1

get current time in kotlin

// declaration
var c : Calendar = Calendar.getInstance()
private var df : SimpleDateFormat? = null
private var formattedDate = ""

// goes to main method or onCreate(Android) 
df = SimpleDateFormat("dd-MM-yyyy HH:mm a")
formattedDate = df!!.format(c.time)
println("Format dateTime => $formattedDate")
Posted by: Guest on March-26-2022
-1

kotlin localdate

val tomorrow = LocalDate.now().plusDays(1)
Posted by: Guest on February-15-2021

Browse Popular Code Answers by Language