Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 12-18-2023 02:57 AM
Hi guys,
I have some problems with transform date from string to long in NIFI. I have date like this: "02-01-1968|" and I need to transform this to long. i am using UpdateAttribte Processor to format it to number like this: ${my_date:toDate("dd-MM-yyyy","GMT"):toNumber()})} but I have result like this: "my_date" : -63072000000 .Does anyone know how to solve this better?
Created 12-18-2023 05:45 AM
Hi @MWM ,
The reason you are getting negative value is because the minimum date in epoch is "January 1st, 1970" which corresponds to "0". It turns out you can still convert the negative value back to date using the following expression:
${my_date:toDate():format("dd-MM-yyyy")}If that helps please accept solution.
Thanks
Created 12-18-2023 05:49 AM
Hi @SAMSAL , Yes i can convert negative value back but i need to send this date as long to other system and this is my problem with converting this date to long in nifi using toNumber() because my value is negative
Created 12-18-2023 06:06 AM
Is the problem that the other system doesnt take negative values?