[
https://issues.apache.org/jira/browse/NIFI-6245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16841853#comment-16841853
]
archon gum edited comment on NIFI-6245 at 5/17/19 2:17 AM:
-----------------------------------------------------------
//[~aaronleon] I'm working on it. I'm going to add two methods based on
nifi-1.9.2 version
h2. 1. formatWithTimeZone()
Currently, it's done and test passed on local
Usage:
{code:java}
// input: /datetime equals 0
// output: 1970-01-01 08:00:00 +0800
formatWithTimeZone( /datetime, "yyyy-MM-dd HH:mm:ss Z", "GMT+8:00")
{code}
h2. 2. toDateWithTimeZone()
Currently, it's done and test passed on local
Usage:
{code:java}
// input: /dt_str equals to "1970-01-01 00:00:00"
// output: -28800000 which is 8 hours
toDateWithTimeZone( /dt_str, "yyyy-MM-dd HH:mm:ss", "GMT+8:00")
{code}
BUT I found out it could be passed by using toDate() and concat() combination.
For example:
{code:java}
// input: /dt_str equals to "1970-01-01 00:00:00"
// output: -28800000 which is 8 hours
toDate( concat( /dt_str, " GMT+8:00"), "yyyy-MM-dd HH:mm:ss Z")
{code}
was (Author: archon):
//[~aaronleon] I'm working on it. I'm going to add two methods based on
nifi-1.9.2 version
h2. 1. formatWithTimeZone()
Currently, it's done and test passed on local
Usage:
{code:java}
// input: /datetime equals 0
// output: 1970-01-01 08:00:00 +0800
formatWithTimeZone( /datetime, "yyyy-MM-dd HH:mm:ss Z", "GMT+8:00")
{code}
h2. 2. toDateWithTimeZone()
working on it.
BUT I found out it could be passed by using toDate() and concat() combination.
For example:
{code:java}
// input: /dt_str equals to "1970-01-01 00:00:00"
// output: -28800000 which is 8 hours
toDate( concat( /dt_str, " GMT+8:00"), "yyyy-MM-dd HH:mm:ss Z")
{code}
> RecordPath format() and toDate() should allow timezone parameter
> ----------------------------------------------------------------
>
> Key: NIFI-6245
> URL: https://issues.apache.org/jira/browse/NIFI-6245
> Project: Apache NiFi
> Issue Type: Improvement
> Affects Versions: 1.9.2
> Reporter: Aaron Leon
> Priority: Minor
>
> The RecordPath toDate and format functions default to system default time
> with no parameter to use different timezones, e.g. UTC which is vital to
> storing date time strings.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)