Last active
September 24, 2020 02:29
-
-
Save kianting/832958a38e28d3791521d079acdf2887 to your computer and use it in GitHub Desktop.
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.* | |
import java.time.format.* | |
def formatTime(unixEpochTime, sFormat, sTimeZone){ | |
def objLocalDateTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(unixEpochTime), ZoneId.of(sTimeZone)); | |
return objLocalDateTime.format(DateTimeFormatter.ofPattern("yyyy:MM:dd")); | |
} | |
println formatTime(Math.round((new Date()).getTime()/1000), 'yyyy:MM:dd', "Pacific/Auckland") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment