In this article we will learn about some of the frequently asked Kotlin programming questions in technical like “date format kotlin” Code Answer. When creating scripts and web applications, error handling is an important part. If your code lacks error checking code, your program may look very unprofessional and you may be open to security risks. Error or stack handling on kotlin was simple and easy. An error message with filename, line number and a message describing the error is sent to the browser. This tutorial contains some of the most common error checking methods in Kotlin. Below are some solution about “date format kotlin” Code Answer.
date format kotlin
xxxxxxxxxx
1
import java.time.LocalDateTime
2
import java.time.format.DateTimeFormatter
3
4
fun main(args: Array<String>) {
5
val current = LocalDateTime.now()
6
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")
7
val formatted = current.format(formatter)
8
println("Current Date and Time is: $formatted")
9
}
10
// Current Date and Time is: 2021-04-10 10:28:21.052