We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Change the date

How to change the date in datepicker with api?

$(this).ejDatePicker({
locale: 'it-IT',
dateFormat: 'dd/MM/yyyy',
buttonText: 'Oggi',
highlightWeekend: true
});

[...]

$(this).ejDatePicker('option', 'value', new Date()); //  ?????

[...]

var dataString = $(this).ejDatePicker('getValue');    // empty

3 Replies

KS Kaliswaran Shanmuga Sundaram Syncfusion Team December 23, 2014 10:04 AM UTC

Hi Stefano,

Thanks for using Syncfusion products.

We can set the value for datepicker control by using the API called “value”. It is used to specify the value for datepicker and its accepts the string or Date object as a value. For your convenience we have prepared a simple sample to show case how to set or get the value of datepicker and it can be downloadable from below link.

Sample Link: DatePicker-sample

In the attached sample, we have used the following code blocks to get or sets the date value.

[Script]

 

// Creating an object to the DatePicker Element

   var datepickObj = $("#datepick").data('ejDatePicker');

 

// Set a value to the DatePicker

   datepickObj.option('value', new Date()); 

 

// Get a value of DatePicker

   var value = datepickObj.option('value');

 

Also if you want to know more about our components to getting started, please find the below link.

http://help.syncfusion.com/web

In order to know more detailed information please refer the below link which includes all the details to get started with our components.

http://help.syncfusion.com/cr/js

Also you can find all the samples of our components in the following link location.

http://js.syncfusion.com/demos/web/

Please let us know if you have further queries.

Regards,

Kaliswaran S



SE Stefano Enrico December 23, 2014 11:09 AM UTC

Ok, solved.
Thanks


KS Kaliswaran Shanmuga Sundaram Syncfusion Team December 26, 2014 04:34 AM UTC

Hi Stefano,
  
        We are glad to hear the provided solution helps for you. Please get back to us if you would require an further assistance.

Regards,
Kaliswaran S

Loader.
Up arrow icon