Created 06-27-2017 04:22 PM
Hello,
Is there a processor help with converting a string(Datetime format: 2017-01-18 13:28:17) to long(133434444545) in a csv field?
Thanks.
Created 06-27-2017 04:58 PM
Hi @Alvin Jin
I haven't seen a special processor to do this yet, but, I've seen a few examples where this can be done using the NiFi Expression Language. These two links should get you going.
Created 06-27-2017 04:58 PM
Hi @Alvin Jin
I haven't seen a special processor to do this yet, but, I've seen a few examples where this can be done using the NiFi Expression Language. These two links should get you going.
Created 06-27-2017 05:24 PM
Thank you for your response.
${now():toNumber():format('yyyy-MM-dd')}
It seems above expression works for attributes.
How to use it to convert a column in csv file?
Thanks.
Created 06-27-2017 07:21 PM
Hi @Alvin Jin
You could use a combination of ExtractText and ReplaceText with some RegEx, though it might be a bit tedious. There is a good example here with screens that you can use as a guide:
Created 06-28-2017 08:16 PM
As of NiFi 1.3.0, you can use UpdateRecord for this. If your incoming field name is "createdOn", you can add a user-defined property named "/createdOn" whose value is the following:
${field.value:toDate('yyyy-mm-dd HH:mm:ss.SSS'):toNumber()}
Note that you may need to change the type of createdOn from String (in the Reader's schema) to Long (in the Writer's schema).
Created 09-12-2018 10:56 AM
How would I use this with a literal letter in my timestamp format? My timestamp format looks like this:
yyyy-mm-dd'T'HH:mm:ss.SSS