Skip to content

Instantly share code, notes, and snippets.

@aliaspooryorik
Created September 27, 2017 14:49
Show Gist options
  • Save aliaspooryorik/9e23bd0ce7392bf1caa32d3a78110f9e to your computer and use it in GitHub Desktop.
Save aliaspooryorik/9e23bd0ce7392bf1caa32d3a78110f9e to your computer and use it in GitHub Desktop.
Parse datetime strings in ACF using Java 8
<cfscript>
s = "2017-08-17T14:34:46.260-0400";
//x = parsedateTime("2017-08-17T14:34:46.260-0400", "pop" ) ;
DateTimeFormatter = createObject("java", "java.time.format.DateTimeFormatter");
parseFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
LocalDateTime = createObject("java", "java.time.LocalDateTime");
dateTime = LocalDateTime.from(parseFormat.parse(s));
writeDump(dateTime);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment