1

In SharePoint 2010 REST API when I call to _vti_bin/ListData.svc/Documents(38)/Created and get JSON response the date/time is returned as /Date(1421146908000)/ (I found some information about it but not still sure what this number counts and from which epoch). But when I get actual value calling to _vti_bin/ListData.svc/Documents(38)/Created/$value, I get Edm.DateTime value 2015-01-13T11:01:48.

Does anyone know

  1. Is it always the case I can rely on? The reason is that I use actually _vti_bin/ListData.svc/ service of SP 2013 server (since I don't have SP 2010).
  2. Is there some official information about date/time formats returned in different cases?
  3. Is it really Edm.DateTime or may be Edm.DateTimeOffset?

Thanks a lot!

3

According to the protocol specification document Edm.DateTime (VJsonDateTime) has the following JSON format:

VJsonDateTime= quotation-mark  
              "\/Date(" 
              ticks
              [("+" / "-") offset]
              ")\/" 
              quotation-mark 

ticks       = *DIGIT 

; ticks is the number of milliseconds since midnight  
; January 1, 1970 

offset      = 4DIGIT
; offset represents the number of minutes to add (if preceded by "+") or substract
(if preceded by "-") from the time value represented by ticks
; if no offset is specified, the value MUST be interpreted as UTC.

;Note: This format is the same used by the ASP.NET 
;AJAX framework, described in http://msdn2.microsoft.com/en-;us/library/bb299886.aspx

From another hand, the document states that DateTimeOffset in JSON should follow the same format as the Date in JSON :

VJsonDateTimeOffset =  VJsonDateTime
  • 1
    Thanks, Vadim - you helps as it always. Do you know is it always the case that getting the value (via $value) instead of JSON returns Edm.DateTime? I noticed that SP 2013 returns Edm.DateTimeOffset format – andrii Mar 26 '15 at 14:31
  • Andrii, that's a nice question, will try to find out and get back to you – Vadim Gremyachev Mar 26 '15 at 14:38
  • 1
    Another note is that JSON returns milliseconds while string $value returns no fractional part of OData.DateTimeOffset, so JSON precision is millisecond but direct $value is limited to second (despite that OData.DateTimeOffset supports any precision). – andrii Mar 27 '15 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.