[
https://issues.apache.org/jira/browse/NIFI-7911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17214730#comment-17214730
]
DEOM Damien commented on NIFI-7911:
-----------------------------------
I got a workaroud for this issuse:
I used The *Updaterecord* processor, and *Nifi expession language:*
{{$\{field.value:toDate(}}{{"dd-MM-yyyy"}}{{,
}}{{'Europe/Paris'}}{{):format(}}{{"yyyy-MM-dd'T'HH:mm:ss.SSS'z'"}}{{,
}}{{'GMT'}}{{)}}}
> 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)