Created
May 30, 2016 12:45
-
-
Save urbansky/ec01f10046a4b266de5ea6b5e37655d2 to your computer and use it in GitHub Desktop.
ISO8601 Date
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.text.DateFormat | |
import java.text.SimpleDateFormat | |
TimeZone tz = TimeZone.getTimeZone("Europe/Berlin") // Change the timezone | |
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmX") // X is the timezone in ISO8601 | |
df.setTimeZone(tz) | |
String iso8601 = df.format(new Date()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment