Parsing the C# datetime to javascript datetime

后端 未结 2 1295
[愿得一人]
[愿得一人] 2021-02-07 05:15

I know that my question is similar to others but I didn\'t found any solution to my problem.

I have a C# DateTime property

 public DateTime MyDate { get;         


        
2条回答
  •  你的背包
    2021-02-07 05:44

    I'm using .Net Core 2.0. & MySQL 5.7

    In my current development, I'm assigning the returned value directly into the DOM object like this:

    DOMControl.value = response.CreatedOn.toString().split(".")[0];
    

    I'm returning a JsonResult of the resulting object, the resulting JSON arrives with the date value as follows:

    {
      ...
      createdOn : "2017-11-28T00:43:29.0472483Z"
      ...
    }
    

    I hope this help to somebody.

提交回复
热议问题