How to parse JSON date format ISO 8601 to string with exact structure and milliseconds

Hello community,
I’m struggeling to get the exact date structre from this JSON request.

change_date_time

It is important to get the exact same value. I have tried to parse it as seen below. But I can’t figure out how to get the same milliseconds like in the request.

changeDateTime = Convert.ToDateTime(item("change_date_time").ToString).ToString("yyyy-MM-dd HH:mm:ss.fff").Replace(" ", "T")

and getting this result: Change Date Time: 2022-04-03T16:35:15.000

Has anybody an idea what I’m missing or what can I do to get the change_date_time value of the JSON request in same format with the milliseconds.

I am very grateful for any advice :slightly_smiling_face:

1 Like

Hi,
I think you can get the output with the Deserialize JSON activity. Will you try?

YourJObjectVar(“yourKey”).value(Of Datetime) maybe will work

Otherweise WE can use the datetime.parseexact method

Hi,
I have tried both using deserialize JSON and also parsing the value to datetime … but what has finally worked for me was to use regex to scrap this date string.

Thank you all for helping!

Hi Roman,
I am currently facing the same problem with converting an JSON ISO8061 Date to String. It would be great if you could explain your regex solution with more details. Thank you!

@guzman
Welcome the forum
Just open a new Topic for your case and get individually help there