简体   繁体   中英

Convert kendodatepicker format to .Net DateTime

The Json value of kendodatepicker that is received at .net csharp code is

"\\"2013-11-18T03:38:21.843Z\\""

What is the best and universal way to parse/convert this format to c# DateTime ?

If you want to have it convert it to localtime, use:
DateTime dt = DateTime.Parse("2013-11-18T03:38:21.843Z")

To keep it as UTC, drop the Z off of the end:
DateTime dt = DateTime.Parse("2013-11-18T03:38:21.843")

Don't forget to dump all of those quotes and escape quotes if they really are present in the string (and not just there because of debugger output).

From kendo dateTime to .net DateTime

var datepicker = $("#datepicker").data("kendoDatePicker");
var value = datepicker.value();
kendo.toString(value,"dd/MM/yyyy")

Try it sir.It might helps u.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM