Support Questions

Find answers, ask questions, and share your expertise

CAN NIFI TRANSFORM A COMPLEX TIMESTAMP ?

avatar
Contributor

Hi everyone,

I'm trying to change this kind of timestamp: "2016-07-06T15:04:33.332+00:00" to this "2016/07/06" with apache Nifi,

i have tried many things but failed miserably.

This is my configuration of the ReplaceText processor

Search Value = ${dbbf.timestamp_da}

Replacement Value = ${bddf.timestamp_da:toDate("yyyy-MM-dd'T'HH:mm:ss.SSSZ"):format('yyyy/MM/dd')}

Character Set = UTF-8 Maximum

Buffer Size = 1 MB

Replacement Strategy = Literal

Replace Evaluation Mode = Entire text

If Anyone can help i would really appreciate, Thanks in advance 🙂

1 ACCEPTED SOLUTION

avatar
Contributor

I appreciate the help and thank you for that. I have found the format of the timestamp which is "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" it was a lot easier after that.

View solution in original post

2 REPLIES 2

avatar
Contributor

One idea is to try an executeprocess and pass the raw date into a shell command like this:

echo "2016-07-06T15:04:33.332+00:00" | awk -F"T" '{print $1}' | sed 's/-/\//g'

produces the format "2016/07/06"

avatar
Contributor

I appreciate the help and thank you for that. I have found the format of the timestamp which is "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" it was a lot easier after that.