[
https://issues.apache.org/jira/browse/NIFI-7911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17214726#comment-17214726
]
DEOM Damien commented on NIFI-7911:
-----------------------------------
Ok, this would involve one of these two options:
* this code is dependant of the computer's timezone (which I'd like to avoid a
all cost)
* the api has changed over the versions
> 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)