a!fromJson () Function Date format

A Score Level 1

Hi all

I have a requirement to build a WEB API and a Process model to update other external system. The request to the web api is:

{
"accountNumber": "20171941",
"houseNumber": "13329892",
"contractStartDate": "2022-08-25T00:00:00.0000000+01:00",
"contractEndDate": "2023-08-25T00:00:00.0000000+01:00"
}

From the WEB API I am using the function a!fromJson to get the values for the process model from the http!request.body, as usual. When we validate the process model and it execution the dates on the request changed from 2022-08-25T00:00:00.0000000+01:00 to 8/24/2022 11:00 PM GMT+00:00.

I understand that the JSON functions detects the Date but we really need to keep that format from the request. Any Idea? 

Thanks

Mario

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    I need to ask this question ... Are you aware that a value and it's visual representation are two different things?

    So, my next question is: "Why do you need to keep that format?"

    a!localVariables(
      local!json: "{
        ""accountNumber"": ""20171941"",
        ""houseNumber"": ""13329892"",
        ""contractStartDate"": ""2022-08-25T00:00:00.0000000+01:00"",
        ""contractEndDate"": ""2023-08-25T00:00:00.0000000+01:00""
      }",
      local!appian: a!fromJson(local!json),
      a!toJson(local!appian)
    )

    This returns a date like: "2022-08-24T23:00:00Z" which is, by the ISO 8601 definition, the exact same value. In UTC.

  • 0
    A Score Level 1
    in reply to Stefan Helzle

    Hi Stefan, thanks for the explanation. 

    When the value is passed from the WEB API to the process Model, I notice that the Strings for the date values change from 2022-08-25T00:00:00.0000000+01:00 to 8/24/2022. I understand that APPIAN understands that the string is a date based on the format but I need to keep the format, this is I need to treat it as string. 

    Mario

Reply
  • 0
    A Score Level 1
    in reply to Stefan Helzle

    Hi Stefan, thanks for the explanation. 

    When the value is passed from the WEB API to the process Model, I notice that the Strings for the date values change from 2022-08-25T00:00:00.0000000+01:00 to 8/24/2022. I understand that APPIAN understands that the string is a date based on the format but I need to keep the format, this is I need to treat it as string. 

    Mario

Children