Skip to main content
sarithe
Silver ⭐️⭐️
May 11, 2023 2:05 PM UTC
Question

Converting timestamp in NIFI

I need to convert timestamp value coming in flowfile of  cst/cdt  time or anytime to UTC in nifi . But I am unable to convert it is not working. Can anybody help on this

2 replies

SAMSAL
Platinum ⭐️⭐️⭐️
May 11, 2023 4:28 PM UTC
cotopaul
Platinum ⭐️
May 12, 2023 11:35 AM UTC

@sarithe,


What is the format of the record you are trying to convert? What is the data type of the field you are trying to convert? Are you trying to modify the value of a record or the value of an attribute?

If you are trying to update the values from within each record, you should try using an UpdateRecord processor, in which you define a Record Writer and a Record Reader. Next, you can add another property in your processor and define it like:
Property: /your_column --> pay attention to the slash in front as it is very important.

Value: ${field.value:multiply(1000):toNumber():toDate("yyyyMMdd", "GMT"):format("yyyyMMdd")} --> this is just an example, as I do not know how your data looks like and how you want it displayed. You can use NiFi's EL to define the exact format you required, but make sure you use field.value if you want to modify the value from within that specific column.

Translate