Using date variables

wjkelly Registered Posts: 22 ✭✭✭✭


I'm wanting to store a date in the project variable list, but can't figure out how to make the variable read as a date in, say, a formula step in a recipe.

I've tried to format the date as "yyyy-MM-dd" with and without quotes, as well as "yyyy-MM-ddT00.00.00.000Z" with and without quotes.

When I do the simple date format without quotes (i.e., just 2022-09-24) the variable UI kicks me the following error message

"Invalid format: Expected ',' or '}' after property value in JSON at position 70"

When I put the simple date in quotes (i.e. "2022-09-24") then the variable UI accepts it, but when I try to use the variable in a formula, it simply resolves the math of the string, in this case to "1989". Here are two views of that - one just calling the variable, another trying to use the variable in a date formula (asDate):

Sample 1.jpgSample 2.jpg

I feel like there must be a way to define the variable as a date, but I can't find that in the documentation.

Thanks for any assistance!

Operating system used: MacOS Monterey v12.4
Operating system used: MacOS Monterey v12.4

Best Answer

  • Miguel Angel
    Miguel Angel Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 118 Dataiker
    Answer ✓


    DSS stores variables as strings. Yet, we can later on parse them to the format we desire.

    For example, in this case the 'asDate' formula fails because the format provided in the second argument does not correspond to the fed data. For example. see Capture.PNG attached (where Rdate is 1989)

    On the other hand, we can also use a 'Parse date' processor to transform the variable into a date, though in this case it is a two step process as the processor acts on columns. See Capture2.PNG


Setup Info
      Help me…