📜  日期格式 kotlin 代码示例

📅  最后修改于: 2022-03-11 14:53:33.392000             🧑  作者: Mango

代码示例1
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

fun main(args: Array) {
    val current = LocalDateTime.now()
    val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")
    val formatted = current.format(formatter)
    println("Current Date and Time is: $formatted")
}
// Current Date and Time is: 2021-04-10 10:28:21.052