Javascript serialization of DateTime in asp.net is not giving a javascript date object?

前端 未结 10 1921
甜味超标
甜味超标 2020-12-01 06:04

When I parse a DateTime to json in .Net it returns a string (i.e. \"\\/Date(1249335194272)\\/\"). How do I make it return a js Date object constructor not wrap

10条回答
  •  心在旅途
    2020-12-01 06:55

    This is a known limitation with JSON. This answer might help you, specifically:

    value = new Date(parseInt(value.replace("/Date(", "").replace(")/",""), 10));
    

提交回复
热议问题