Skip to content

Instantly share code, notes, and snippets.

@sbutterfield
Last active July 31, 2022 17:32
Show Gist options
  • Save sbutterfield/32b1a29008de364f1d390ef80f38b9ea to your computer and use it in GitHub Desktop.
Save sbutterfield/32b1a29008de364f1d390ef80f38b9ea to your computer and use it in GitHub Desktop.
sfdc-datetime-to-groovy2.4-date
import java.text.DateFormat
import java.text.SimpleDateFormat
// def inputDatTimeString = "2015-07-23T13:46:00.000Z"
def inputDatTimeString = "2015-07-23T14:06:00.000Z"
DateFormat inputDateTimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX")
// X instead of 'Z'
// inputDateTimeFormat.setTimeZone(TimeZone.getTimeZone("GMT"))
def date = inputDateTimeFormat.parse(inputDatTimeString)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment