How to handle json DateTime returned from WCF Data Services (OData)

前端 未结 8 819
情书的邮戳
情书的邮戳 2020-12-01 11:19

I believe I am missing something obvious here. When I request a JSON response from an OData service I get a different result for the DateTime properties than I do when I req

8条回答
  •  生来不讨喜
    2020-12-01 11:24

    This reply might get voted down (!!) but an alternative solution is to just change your WCF Service to return the dates in a more friendly way.

    Here's some sample JSON from my WCF service, showing a UpdateDateOriginal value (using the annoying default formatting that WCF has used for my DateTime value), and a friendlier UpdateDate version of the same DateTime value.

    enter image description here

    I've posted the code to do this in the following article:

    Change default date serialization in WCF

提交回复
热议问题