jQWidgets Forums

jQuery UI Widgets Forums Editors DateTimeInput Set Date time

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 11 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Set Date time #53344

    Anil Kumar
    Participant

    hi,

    I want to this format of date. If I input “55” as month than it should be “05” as month If month is grater then “12” . According to my below code if in input “55 ” as date /time month become “12” and date become “30”

    but it should be 05 as month and 05 as date

    //Set date input
    $(“#dtPickerAddDate”).jqxDateTimeInput({ width: ‘145px’, height: ’22px’, theme: ‘default’, formatString: “MM/dd/yyyy” });
    var getDate = $(‘#dtPickerAddDate’).jqxDateTimeInput(‘getDate’);
    var formattedDate = $.jqx.dataFormat.formatdate(getDate, ‘MM/dd/yyyy’);
    if ($(“#hdnVisitDate”).val() != ”) {
    formattedDate = $.jqx.dataFormat.formatdate($(“#hdnVisitDate”).val(), ‘MM/dd/yyyy’);
    $(‘#dtPickerAddDate’).jqxDateTimeInput(‘setDate’, new Date(formattedDate));
    }
    else {
    $(“#hdnVisitDate”).val(formattedDate);
    }
    $(‘#dtPickerAddDate’).on(‘valuechanged’, function (event) {
    var jsDate = event.args.date;
    var formattedDate1 = $.jqx.dataFormat.formatdate(jsDate, ‘MM/dd/yyyy’);
    $(“#hdnVisitDate”).val(formattedDate1);
    });

    Thanks Regard’s
    Anil Kumar

    Set Date time #53350

    Peter Stoev
    Keymaster

    Hi Anil Kumar,

    The “val” and “setDate” methods expect JavaScript Date objects, not Strings as parameters.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.