parseToDate error

I ran the following code:

parseDate(concat(toString(year), ‘/’, toString(month), ‘/’, toString(day)), [‘yyyy/MM/dd’])

and get the error message " At least one of the arguments in this function does not have correct type. Correct the expression and choose Create again."

The fields year, month and day are IntegerType. Month is coded with single and double place values (1,2,3…10,11,12). The data is imported to Quicksight from Athena.

Any ideas how to solve this problem? Would be very grateful!

Hi @svela,

You have some square brackets around the date format that should not be there.

The correct formula would like something like this:

parseDate(concat(toString(year), '/', toString(month), '/', toString(day)), 'yyyy/MM/dd')

Kind regards,

1 Like

Dear @andres007,

Thanks for your swift reply. I fixed this but, unfortunately, it does not change anything - same error remains.

Hi @svela - Can you please share sample data and expected output so that we can try to replicate it from our side and guide you.

Regards - Sanjeeb

1 Like

Can you check the types of quotes you are using? When I paste the code you added in my editor they show incorrectly. You can also try copy/paste the pice of code I put on my original message, that one should not give you any syntax errors.

1 Like

Thank you @andres007 , the code above did actually work. I marked it as solution. Thanks a lot!!