0

I want to add months to a date (YYYYMMDD), which is a string currently '20190101'.

to add months i use: addmonths(date('20190101'),12)

which would give me "2020-01-01" as a date

But I only want "202001" as my final output. I tried doing the below but doesn't seem to work! enter image description here

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
X0123
  • 1
  • 3

1 Answers1

0
TO_VARCHAR(ADDMONTHS(DATE('20190101'), 12), 'YYYYMM')

Similar to https://stackoverflow.com/a/46985953/18667225

Markus
  • 5,976
  • 5
  • 6
  • 21