Search code examples
javascriptjquerykendo-uikendo-datetimepicker

How to get only year from kendo datepicker?


I want to get only year from kendo datepicker.

var defaultyear = $("#datepicker").val();
// 2/22/2015

I want '2015'. I do not want to change display format. Thanks.


Solution

  • Solved :)

      var defaultyear=kendo.toString($("#datepicker").data("kendoDatePicker").value(), 'yyyy');