Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Replace Timestamp Attribute

Highlighted

Replace Timestamp Attribute

New Contributor

Hello,

I am using Nifi to pull values from sensors & store it to a database. How to convert a timestamp of regular time to UTC timestamp?

attribute name - timestamp

value now - 2019-06-17 14:46:18.370

value desired- 2019-06-17T14:46:18.370Z

I tried formatting date in UpdateAttribute processor but it didn't work -

$(timestamp:toDate("yyyy-MM-dd hh:mm:ss.ttt"):format("yyyy-mm-ddThh:mm:ss.tttZ"))

I appreciate your answers. Thanks.

1 REPLY 1

Re: Replace Timestamp Attribute

Super Guru

@Karthikeyyan Subbiah

I think your attribute is not coming as attribute of the flowfile, if your attribute is in content of flowfile then UpdateAttribute processor won't work.

We need to use UpdateRecord processor for that and give the path as /<attribute_name> and add your logic to get the desired format of timestamp.

Don't have an account?
Coming from Hortonworks? Activate your account here