Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Today date to kendo datepicker

Tags:

I want to set today date to Kendo DatePicker on clear button click. I tried following but it is not working.

$('#btnClear').click(function () {   $("#StartDate").data("kendoDatePicker").value(new Date()); }); 

Above code don't give any error and don't set today date. It clears kendo DatePicker's textbox value. Note: Kendo DatePicker format is MM/dd/yyyy.

like image 993
Dhwani Avatar asked Aug 16 '14 06:08

Dhwani


People also ask

How can I select current date in DatePicker?

On an Access form, use the Date Picker to enter the current date. If the field is set up as a Date/Time field, the Date Picker icon appears when you click in the field. Click the icon, and then click the Today button below the calendar.

How do I change date format in kendo DatePicker?

format String (default: "M/d/yyyy") Specifies the format, which is used to format the value of the DatePicker displayed in the input. The format also will be used to parse the input. For more information on date and time formats please refer to Date Formatting.


1 Answers

I tried following and works perfectly for me.

$('#btnClear').click(function () {   var todayDate = kendo.toString(kendo.parseDate(new Date()), 'MM/dd/yyyy');   $("#StartDate").data("kendoDatePicker").value(todayDate); }); 
like image 105
Dhwani Avatar answered Sep 18 '22 17:09

Dhwani