user2837167
user2837167

Reputation: 231

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 ?

Upvotes: 0

Views: 2473

Answers (2)

Triple K
Triple K

Reputation: 399

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.

Upvotes: -1

Lynn Crumbling
Lynn Crumbling

Reputation: 13357

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).

Upvotes: 2

Related Questions