Support Questions
Find answers, ask questions, and share your expertise

Replace Timestamp Attribute

New Contributor


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.


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.

; ;