I am pulling data from work item changes in ADO calling
https://dev.azure.com/{organization}/{project}/_apis/wit/workItems/{id}/updates?api-version=6.0
Unfortunately I am getting values back that look like
"System11111ChangedDate": {
"oldValue": "2021-09-28T23:59:171111146Z",
"newValue": "2021-09-28T23:59:2411111677Z"
}
and when I take
string dt = "2021-09-28T23:59:2411111677Z";
DateTime.Parse(dt, null, System.Globalization.DateTimeStyles.RoundtripKind);
I get
{"String '2021-09-28T23:59:2411111677Z' was not recognized as a valid DateTime."}
I have been messing around with this for a while and still have yet to get it to work.
Any thoughts on how I can do this conversion?
TIA
The original format for ISO 8601 is "yyyy-MM-ddTHH:mm:ss.fffffffz"
The string which you have provided is not in a correct format. One (.) dot is missing after seconds ( ie, 24 in your string).
I have tried using the same given format by adding the extra dot
string dt = "2021-09-28T23:59:24.11111677Z"; DateTime dt1 = DateTime.Parse(dt, null, System.Globalization.DateTimeStyles.RoundtripKind);
Got the below output
9/28/2021 11:59:24 PM
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.