Can not convert 6 digit milliseconds in NiFi. String to toDate() conversion problem in NiFi.
Hello All and
I have a CSV file with a time column "Apr 15, 2020 02:02:16.388267000 Paris, Madrid (heure d’été)".... "Apr 15, 2020 02:02:16.986879000 Paris, Madrid (heure d’été)"...etc.
Then I to convert the field time using UpdateRecord processor by the following code:
${field.value:substring(0,28):toDate("MMM dd,yyyy HH:mm:ss.SSSSSS"):format("yyyy-MM-dd HH:mm:ss.SSSSSS")}
But after conversion, the output I get is:
| nb | time | delta |
| 1 | 2020-04-15 02:08:44.000267 | 0.0 |
| 2 | 2020-04-15 02:18:42.000879 | 0.598612 |
But the output should be:
| nb | time | delta |
| 1 | Apr 15, 2020 02:02:16.388267 | 0.0 |
| 2 | Apr 15, 2020 02:02:16.986879 | 0.598612 |
So, I always get 000 before the milliseconds. As per the example above, I got 000267 instead of 388267 and 000879 instead of 986879.
Why I am getting the 000 instead of the real value? How can I modify me code to resolve this problem? Any help on this issue will be highly appreciated.

