Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Unable to convert date to a particular format

Rising Star

Hello, please kindly help. i am trying to convert a datetime(attribute) from one format to the other but it keeps giving me empty value on the attribute:

SCENERIO:
Flowfile is json----->extract date from Json flowfile using Evaluatejsonpath---->format date using Updateattribute

Actual Date: "2022-08-01 00:00:00.0"

Desired date: "01/08/2022 00:00:00.000000"

I have tried to use this on the updateattribute, but it is not working:

${DATE_TIME:toNumber():toDate('yyyy-MM-dd hh:mm:ss.S'):format('dd/MM/yyyy HH:mm:ss.SSSSSS')}

 

Thank you.

1 ACCEPTED SOLUTION

Master Collaborator

@rafy 

 

Try this:

${DATE_TIME:toDate('yyyy-MM-dd HH:mm:ss.SSSSSSSSS'):format('dd/MM/yyyy HH:mm:ss.SSSSSS')}

 

Cheers,

André

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.

View solution in original post

2 REPLIES 2

Master Collaborator

@rafy 

 

Try this:

${DATE_TIME:toDate('yyyy-MM-dd HH:mm:ss.SSSSSSSSS'):format('dd/MM/yyyy HH:mm:ss.SSSSSS')}

 

Cheers,

André

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.

Rising Star

Thank you sir. It works. 

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.