How to Convert .NET DateTime to JSON

后端 未结 2 1465
深忆病人
深忆病人 2021-01-21 07:10

My WCF webservice is returning C# DateTime objects as JSON like this,

\"/Date(1293793200000+1300)/\"

I have found this,

Converting .NET DateTime to JSON<

相关标签:
2条回答
  • 2021-01-21 07:35

    You can ignore the time zone offset - the number of milliseconds is always relative to UTC (see the "DateTime wire format" section at http://msdn.microsoft.com/en-us/library/bb412170.aspx). The offset mostly indicates that the original DateTime value was of DateTimeKind.Local, but the serialized milliseconds since the epoch is always relative to GMT.

    0 讨论(0)
  • 2021-01-21 07:35

    You can convert the DateTime object in .NET to a string and just serialize the string. That's what I did. See Proper way to format date from database using javascript/jquery

    0 讨论(0)
提交回复
热议问题