jquery - datetime is not valid from datetime picker MVC4 -


we displaying dates in mvc view below jquery datetime picker.

$.widget("df.datetime", $.df.datetimecontrols, {     _createinput: function ()     {         var min = this.element.attr("data-minreldate"),             max = this.element.attr("data-maxreldate");          this._input = $("<input>")             .addclass("datetime")             .attr("disabled", this._getdisableprop() ? "disabled" : "")             .prop("disabled", this._getdisableprop() ? true : false)             .addclass(this._getdisableprop() ? "disabled" : "")             .datetimepicker({                 numberofmonths: 2,                 mindate: min,                 maxdate: max,                 //uncomment below line date format.                 //dateformat: $.datepicker.rfc_1123,                 timetext: "current time:",                 hourgrid: 2,                 minutegrid: 5,                 timeformat: "hh:mm tt",                 onselect: $.proxy(this._change, this),                 beforeshow: $.proxy(this._focushndlr, this, 4),                 onclose: $.proxy(this._focushndlr, this, -4)                 //timezone not supported across browsers.to manually there change in                  //  years(save light day etc.,) https://github.com/timrwood/moment/issues/162             })             .focus($.proxy(this._inputfocus, this))             .blur($.proxy(this._inputblur, this))             .appendto(this._wrapper);          //base element value widgets value.         if ($(this.element).val() != "") {             // if wont specify time on recreate time sliders stay unchanged.             //  manipulate datepicker value , value of input display differently.             //  llll--> thursday, april 18 2013 1:20 pm             //  l --> 04/18/2013             //  lt --> 8:30 pm            this._input.datepicker("setdate", new date(moment($(this.element).val()).format("llll")));            this._input.val(moment($(this.element).val()).format("l lt"));         }     }, 

my editor template is:

<input data-val="true" id="fromdate" type="datetime" class="datetime" data-datetime-in="utc" data-datetime="" value ="@model" /> 

the problem when display date in view displaying wrongly.

for ex: have date in db "2015-02-27 00:00:00 +05:30"

on getting displayed "03/02/2017 12:00 am"

can advise wrong here?


Comments