Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Who agreed with this solution

avatar
Master Guru
@Alex M

Use the below expression language to convert into date

${<attribute-name>:toDate("MMM dd yyyy hh:mm:ss","GMT"):format("yyyy-MM-dd HH:mm:ss")}

in the above expression language we are matching the input date by using toDate function and using format function we are formatting the date value to yyyy-MM-dd HH:mm:ss.

to get only the date then use format function until date i.e yyyy-MM-dd

${<attribute-name>:toDate("MMM dd yyyy hh:mm:ss","GMT"):format("yyyy-MM-dd")}

Example:-

I'm having generateflowfile processor with new property dr added as

72840-generateflowfile.png

UpdateAttribute Configs:-

Added two properties in update attribute processor as below

gmt

${dr:toDate("MMM dd yyyy hh:mm:ss","GMT"):format("yyyy-MM-dd HH:mm:ss")} 

not_gmt

${dr:toDate("MMM dd yyyy hh:mm:ss"):format("yyyy-MM-dd HH:mm:ss")} 

72841-updateattr.png

Output Flowfile attributes:-

72842-output.png

In addition we can use timezone with format function also,For more details regarding date conversions refer to this link.

-

If the Answer addressed your question, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.

View solution in original post

Who agreed with this solution