Last active
July 21, 2023 02:41
-
-
Save jickoo/0f73cbb25dce2e555c5defc8fabc56d6 to your computer and use it in GitHub Desktop.
Kotlin Handle Epochtime #kotlin #epoch #epochtime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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