Skip to main content
Solved

How can we convert a string variable to a date?How can I fix the bug?

  • April 19, 2023
  • 3 replies
  • 16 views

Ekran görüntüsü 2023-04-19 161057

Best answer by divya.jain12

Hi,

Can you try running this:

to_date(<%=Year%>,FORMAT('%Y'))

But if you want to convert the whole date with month and day included, it should be:

to_date(<%=Year%>,FORMAT('%Y%m%d'))

You just have to add single quotes.

Hope this helps :)

3 replies

  • Level 4
  • Answer
  • April 19, 2023

Hi,

Can you try running this:

to_date(<%=Year%>,FORMAT('%Y'))

But if you want to convert the whole date with month and day included, it should be:

to_date(<%=Year%>,FORMAT('%Y%m%d'))

You just have to add single quotes.

Hope this helps :)


  • Author
  • Level 8
  • April 24, 2023

Hi,

Can you try running this:

to_date(<%=Year%>,FORMAT('%Y'))

But if you want to convert the whole date with month and day included, it should be:

to_date(<%=Year%>,FORMAT('%Y%m%d'))

You just have to add single quotes.

Hope this helps :)

Hello Divya, I am so thankful for your answers, it helped me a lot. Sorry for the late reply, we were on a public holiday.


No Problem :)