0

I am trying to read some data from the SharePoint API via the older _vti_bin/client.svc endpoint

I can't seem to find what type of date format this is and how I can parse it via C#.

The timestamp being returned is:

"LastContentModifiedDate": "/Date(2022,3,18,13,12,28,990)/"

The year and month are obvious so I could parse it myself if I knew what all the values are. Is there a formal definition for this or a way to parse this reliably? Is this a DateTime or DateTimeOffset or something else?

I just get an exception when trying to deserialize to a DateTime or DateTimeOffset.

B Adams
  • 77
  • 2
  • 6

1 Answers1

0

The /Date(...)/ format is Microsoft's built-in JSON date format.
You can try to parse it using the code below.
You can also check out this post, which provides a lot of methods.

using System.Web.Script.Serialization;    
//code
JavaScriptSerializer json_serializer = new JavaScriptSerializer();
DateTime ddate = json_serializer.Deserialize<DateTime>(@"""\/Date(1326038400000)\/""").ToLocalTime();
Lan Huang
  • 613
  • 2
  • 5