Skip to content

Instantly share code, notes, and snippets.

@jickoo
Last active July 21, 2023 02:41
Show Gist options
  • Save jickoo/0f73cbb25dce2e555c5defc8fabc56d6 to your computer and use it in GitHub Desktop.
Save jickoo/0f73cbb25dce2e555c5defc8fabc56d6 to your computer and use it in GitHub Desktop.
Kotlin Handle Epochtime #kotlin #epoch #epochtime
import java.time.Instant
import java.time.LocalDateTime
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
val epochTime = 1689734454000L
val now = System.currentTimeMillis()
val ldt = LocalDateTime.ofInstant(
Instant.ofEpochMilli(now),
ZoneOffset.systemDefault() // ZoneId.of("Asia/Seoul")
).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
println(ldt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment