How to convert string format YYYYMMdd to date

Hi,
I have a string field, such as 20230520 and I would like to convert to a date field.
I tried to convert by parseDate and formatDate function, but is doesn´t work, I mean, it doesn´t error, but it doesn´t reconize as a date.
Any idea?
tks
July

Hi @July - Welcome to AWS QuickSight community and thanks for posting the question. You can change the data type of the field to yyyymmdd . Please see the below screenshot for the same.

Hope this will help you.

Regards - Sanjeeb

2 Likes

Thank you for your answer
I am going to try that and I let you know.

Best Regards
July.

2 Likes

Hello!

It´s working.
Tks a lot

2 Likes

I tried this way on data imported from Aurora and it did not work. the field is recognized as Integer and when I click on it and convert it to “Date” it does not let me input the format. QuickSight parses it wrongly.

image

Hi @Ali_B - What is your input data format? If the data format is already in date, what is your requirement over here, please give details.

Regards - Sanjeeb

Hi, the input data is an integer like this (20230603), QuickSight recognizes it as an integer and I want to convert it to date.

The only way that worked is by creating a calculated field and using this expression:

parseDate(concat(left(toString({SHIFT_DATE}),4),‘-’,substring(toString({SHIFT_DATE}),5,2),‘-’,right(toString({SHIFT_DATE}),2)),‘yyyyMMdd’)

1 Like

Hi @Ali_B - Yes you did the right approach, for the problem statement you have mentioned, the solution you followed is correct.

Regards - Sanjeeb