Created
March 18, 2020 20:06
-
-
Save sammy2077/522982a71afec11bd47a6575d04c6328 to your computer and use it in GitHub Desktop.
Getnerate current timestamp in kotlin
This file contains 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.ZoneId | |
import java.time.format.DateTimeFormatter | |
fun main() { | |
val time=DateTimeFormatter | |
.ofPattern("yyyyMMddHHmmss") | |
.withZone(ZoneId.of("Africa/Nairobi")) | |
.format(Instant.now()) | |
println(time) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment