I want to convert a 6 digit integer to a date

Is there a way to convert a 6 digit integer (eg 202201) to a date?

assuming the first 4 digits are the year, and the last 2 digits are the month, you could try something like this.

parseDate(concat(substring(toString({6 digit interger}), 1, 4), β€˜/’, substring(toString({6 digit interger}), 5, 2), β€˜/’, β€˜01’), β€˜yyyy/MM/dd’)

Which takes the year and month from your integer, then gives it a day of 01 since a date has to have a day attached, and puts it in a format that quicksight can recognize as a date. Once the calculated field has been created you can find it in the fields list, click on the ellipsis, then format, Sep 2022. This way its only displaying the year and month, since you don’t actually care about the day.

1 Like

Thank you for your reply! It is complete!

We are currently outsourcing the construction of quicksight.
But at the same time, we are learning about it and some questions have begun to arise like this one.

It was a great help.

1 Like