date and time to JSON

Hello,

I have a problem with the type in Appian DATE AND TIME, because after use a variable in this type, I need to change the format to JSON Format, and the values changes.

This  is an example:

  • Appian: timeStampMod=5/15/2019 4:31 PM,
  • JSON: timeStampMod": 2019-05-15T16:31:28.220Z

Someone knows how can I do to dont change de data of my variable in Date and Time type when I change to JSON format?

Thank you so much.

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    For some reason, Appian's out-of-box JSON convertor doesn't convert dates back from JSON correctly in the format they were originally converted to JSON in.  I believe you will find past threads on this issue if you search back through community. 

    I believe you might need to try one of various workarounds, including either storing the timestamp in json as an integer, and converting it back after retrieval, or perhaps more cleanly, storing it to JSON as text where you preformat it in such a way that one of the Appian date&time functions can read it back easily.  And if all else fails, I believe you could build a function that correctly translates the JSONized timestamp back correctly, though this might actually be harder than the other ways I mentioned.

Reply
  • +1
    Certified Lead Developer

    For some reason, Appian's out-of-box JSON convertor doesn't convert dates back from JSON correctly in the format they were originally converted to JSON in.  I believe you will find past threads on this issue if you search back through community. 

    I believe you might need to try one of various workarounds, including either storing the timestamp in json as an integer, and converting it back after retrieval, or perhaps more cleanly, storing it to JSON as text where you preformat it in such a way that one of the Appian date&time functions can read it back easily.  And if all else fails, I believe you could build a function that correctly translates the JSONized timestamp back correctly, though this might actually be harder than the other ways I mentioned.

Children
No Data