Date to YYYY-MM-DD (because of REST endpoint)

Hi all,

I have want my date to be YYYY-MM-DD, this needs to be te same everywhere and anytime, because my REST endpoint only accept the date value in this format. Is this possible? If someone else his device is in an other time format or something the POST won’t work.

If i leave the date out my JSON body the webhook works great… so only this (simple) thing is holding me back… Date format is something you want to specify in the column settings?

-Remco

@Remco_Edelenbos
In your JSON body, you can always force the date in a required format with this:

{
	"Date": "<<CONCATENATE(YEAR([DateColumnName]),"-",IF(MONTH([DateColumnName])<10,"0"&MONTH([DateColumnName]),MONTH([DateColumnName])),"-",IF(DAY([DateColumnName])<10,"0"&DAY([DateColumnName]),DAY([DateColumnName])))>>"
}

Update the “Date” parameter name and [DateColumnName] as per your required setup.

1 Like

@Remco_Edelenbos
Thank to Master @Aleksi, he reminded me a shorter version of the above expression:

{
	"Date": "<<YEAR([DateColumnName])&"-"&RIGHT("0"&MONTH([DateColumnName]),2)&"-"&RIGHT("0"&DAY([DateColumnName]),2)>>"
}

Thanks for your reaction. So like this?

{
  "KnCustomK01": {
    "Element": {
      "Fields": {
        "U889D35E546D880763FE77396BE54E696": "<<Pcode>>",
        "UE3C3929A4C70126CEA1D2D8710EBCEEE": "<<Scode>>",
        "U5C73AC614FF69DB2E32B5D88B79FAEB6": "<<Trailercodering>>",
        "UE7D0AFF74FF97B7F4B884AB156D3CEC9": "<<YEAR([Datum laden])&"-"&RIGHT("0"&MONTH([Datum laden]),2)&"-"&RIGHT("0"&DAY([Datum laden]),2)>>",
        "U3D8013524B63D7B37D050DBA97B96380": "<<Tcode>>",
        "U7988D2FD43158EBF72D397A0F8C41000": "<<Datum aankomst>>",
        "UD22F6B6A422FEF40EA56D8AFA8A30AEA": "<<Aantal KM>>",
        "U3A0AFC2F4C7ABF0191AFABB8239233DA": "<<Prijs transport>>",
        "UD3E2868C4EDD4DBD3C7B3D9CC77204E8": "<<Tijdstip laden>>",
        "UEC71E25745189CDB88B7CF9CA7F489E4": "<<Herkomst (project)>>",
        "U4AD1784A4F751DB21605EA9437BBAC49": "<<Status>>",
        "U2B79F3354AECBFC3EDD2D592B3684275": "<<Tijdstip aankomst>>"
      }
    }
  }
}

Thnks!!

@Remco_Edelenbos
Correct