Skip to content

Instantly share code, notes, and snippets.

@urbansky
Created May 30, 2016 12:45
Show Gist options
  • Save urbansky/ec01f10046a4b266de5ea6b5e37655d2 to your computer and use it in GitHub Desktop.
Save urbansky/ec01f10046a4b266de5ea6b5e37655d2 to your computer and use it in GitHub Desktop.
ISO8601 Date
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