[
https://issues.apache.org/jira/browse/NIFI-7911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17212578#comment-17212578
]
Matt Burgess commented on NIFI-7911:
------------------------------------
I get the same result in GroovyConsole and NiFi (although my result is
2020-10-06T03:10:00.000Z as I'm probably in a different timezone). I am using
Groovy 2.5.9 and NiFi uses 2.5.4. Maybe something is different in Groovy 3?
> Groovy Executescript: fail to convert timezone
> ----------------------------------------------
>
> Key: NIFI-7911
> URL: https://issues.apache.org/jira/browse/NIFI-7911
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 1.12.0, 1.11.4
> Reporter: DEOM Damien
> Priority: Major
>
> Nifi's execute script fails to properly convert timezones in Groovy
> The following code gives the correct result on my local machine (groovy
> console 3.0.1): *2020-10-05T21:10:00.000Z*
>
>
> {code:java}
> import java.text.DateFormat
> import java.text.SimpleDateFormat
> import org.apache.commons.io.IOUtils
> import java.nio.charset.StandardCharsets
> SimpleDateFormat date_format=new SimpleDateFormat("dd-MM-yyyy HH:mm:ss",
> Locale.FRANCE);
> def date_str = date_format.parse("05-10-2020
> 23:10:00").format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", TimeZone.getTimeZone("UTC"))
> log.error(date_str)
> {code}
>
>
> On Nifi, I get *2020-10-05T23:10:00.000Z*
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)