Kotlin Program to Get Current Date/TIme.Kotlin doesn’t have its own date and time implementation. Kotlin and Java are “compatible”, they use the same virtual machine and that’s why they can share their classes.Therefore, Kotlin uses Java classes for date and time. Date – The Date class from the java. util package was the first attempt at storing date and time in Java.
Kotlin Program to Get Current Date-TIme
Source Code
import java.time.LocalDateTime
fun main(args: Array<String>) {
val current = LocalDateTime.now()
println("Current Date and Time is: $current")
}
Output
Kotlin Program to Get Current Date-TIme