Groovy web console

subscribe to the feed Subscribe
to this
site

Parse date

Published 1 month ago by Anonymous
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
String result = "Formato yyyy-MM-dd'T'HH:mm:ss.SSSX"
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX")
result += "\n-03:00: " + sdf.parse("2020-01-01T15:30:00.000-03:00")
result += "\n-0300:  " + sdf.parse("2020-01-02T15:30:00.000-0300")
result += "\n-03:    " + sdf.parse("2020-01-02T15:30:00.000-03")
result += "\nZ:      " + sdf.parse("2020-01-03T18:30:00.000Z")