Date - String to YYYYMM

cb86
cb86 Registered Posts: 3 ✭✭✭

Hello,

I have a date (YYYYMM) that is being read as a string. How can i convert/parse this date to be read as a date?

Best Answer

  • Célian
    Célian Dataiker, Registered Posts: 4 Dataiker
    Answer ✓

    "yyyy-MM" would parse dates with a '-' between the year and the month, for example "2021-01"

    To parse "202101" you need to set the format to "yyyyMM" (without the '-')

Answers

  • Célian
    Célian Dataiker, Registered Posts: 4 Dataiker

    Hello,

    In a prepare recipe, you can use a Parse Date step to convert strings to date in the format you want.

    Capture d’écran 2021-05-20 à 16.15.20.png

  • CoreyS
    CoreyS Dataiker Alumni, Dataiku DSS Core Designer, Dataiku DSS Core Concepts, Registered Posts: 1,149 ✭✭✭✭✭✭✭✭✭

    Hi @cb86
    and welcome to the Dataiku Community. In addition to @Célian
    's excellent explanation I believe this thread should help as well:

    I hope this helps!

  • cb86
    cb86 Registered Posts: 3 ✭✭✭

    Thank you both for your quick response. I tried to use the prepare recipe to parse the date. However, I am not seeing any results? I am doing it correctly (image attached)?

  • cb86
    cb86 Registered Posts: 3 ✭✭✭

    Thank you!

Setup Info
    Tags
      Help me…