New to Telerik Reporting? Download free 30-day trial

Change DateTime parameter format (HTML5 Report Viewer)

Environment

Product Version 13.0.19.116
Product Progress® Telerik® Reporting

Description

How could I change DateTime parameter format?

Solution

Telerik Report Viewer uses Kendo UI for its default template. The DateTime parameter is a Kendo UI DatePicker widget which supports formating the value displayed in the input. To change the format, you need to listen for renderingEnd event on the Telerik Report Viewer, which is fired after the report and the parameter area are loaded and rendered on the page. Then get the Kendo DatePicker widget and set the wanted format. For more information on date and time formats please refer to Date Formatting.

$("#reportViewer1")
    .telerik_ReportViewer({                  
        renderingEnd: function () {
        var datepickers = $("#reportViewer1").find("[data-role='datepicker']");

        if (datepickers.length) {
            datepickers.each(function (index) {
                $(this).data("kendoDatePicker").setOptions({
                    format: "MM/dd/yy"
                });
            });

        }
    }
...
In this article