Support Questions

Find answers, ask questions, and share your expertise

How to convert "file.creationtime" to timestamp format?

avatar
Explorer

Is there some way to convert "file.creationtime" format to timestamp format?

Like below:

110246-1565319679857.png to 110286-1565319711365.png




3 REPLIES 3

avatar
Master Guru

@Raymond Cui

Try with adding new attribute in UpdateAttribute processor as


epochtime

${file.creationTime:toDate("yyyy-MM-dd'T'HH:mm:ss+0000"):toNumber()}

Then nifi will match the format and convert to epoch time.

avatar
New Contributor

AshuGang_0-1701074425329.png

${file.creationTime:toDate("yyyy-MM-dd'T'HH:mm:ss+0000"):toNumber()} = not working

avatar
Super Collaborator

Your original example had everything at +0000 but the error has +0700 so perhaps change the pattern to 

yyyy-MM-dd'T'HH:mm:ssZ