Kendo DateTimePicker will not take a different format

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    2 posts
    Member since:
    Jan 2015

    Posted 03 Feb 2015 Link to this post

    Hi,

    I am trying to set a default value of today in my datetimepicker.  However, it will not allow me to change the date time format from "Tue Feb 3 13:54:54 EST 2015" format which I an unable to convert in the c# code.  Here is my javascript code:
    var startDateString = '';
    $("#start-date-datepickerId").kendoDateTimePicker({
    value: new Date(),
    change:
    function () {
    startDateString = kendo.toString(
    this.value());
    },
     
    format: "0:MM/dd/yyyy"
     
    });

    if (startDateString == '')

    startDateString = kendo.parseDate($("#start-date-datepickerId").data("kendoDateTimePicker").value());

    Any and all help is appreciated

  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 05 Feb 2015 Link to this post

    Hi Daniel,

    Setting an initial value is indeed done through the value option, as in the example you shared. I am not exactly sure what is the expected behavior, however I would recommend supplying a format parameter for the toString method.

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top