-
-
Save miguelzetina/1d89f0cd404b3754cc438a6b3a787a01 to your computer and use it in GitHub Desktop.
current date in iso 8601 in groovy
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
new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC")) |
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
Date.parse("yyyy-MM-dd'T'HH:mm:ss'Z'", dateString) | |
// Important: the quotes around Z help parse Z as literal in input string (represents UTC). | |
// If we omit quotes in format string, the numeric (ex: +0000) timezone must be present in the input string | |
Date.parse("yyyy-MM-dd'T'HH:mm:ss'Z'", "2001-01-01T00:00:00Z") | |
Date.parse("yyyy-MM-dd'T'HH:mm:ssZ", "2001-01-01T00:00:00+0000") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment