Parsing a JSON Date/Time value using the Windows.Data.Json library in C#/WinRT project

I am receiving a JSON DateTime value that looks like the following: "/Date(1313438502992)/" How can I convert it to the proper DateTime value in C# using the Windows.Data.Json library? Using the following code results in an incorrect DateTime value being reported: string dateValue = value.GetString(); //we get a value like "/Date(1313438502992)/" dateValue = dateValue.Replace("/Date(", ""); dateValue = dateValue.Replace(")/", ""); var PublishDate = new System.DateTime(Convert.ToInt64(dateValue)); Not sure if the JSON encoder and the C# DateTime object use the same concept of the epoch. Any guidance would be deeply appreciated.
I think "/Date(1313438502992)/" contains DateTime object as ticks & it returns me "01/02/0001 12:29:03", are you getting the same ?

以上就是Parsing a JSON Date/Time value using the Windows.Data.Json library in C#/WinRT project的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JSON 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏