Change Date Format in Calendar Control Date field

オフライン

I have a date field in my custom form that is not bound to any item type. The Calendar Control Time selection is disabled by default as the default format is Short date. How do i change this to long date so the time selection is enabled?

Parents Reply Children
  • Hi Neha

    You can use below html in form to get the custom date format

    Step 1: In form create two fields (text and html)

    Step 2: For Text field, give name as date and Label as Date

    Step 3: For HTML field, give name as selectdate and Label as Empty

    Step 4: Copy below HTML code

    <input name="selectdate" align="absmiddle" style="display: inline; cursor: pointer;" class="sys_f_input_image sys_f_input_image_ie" onclick="myFunction()" type="image" src="../images/calendar.svg" border="0" title="Date Dialog">
    </input>
    <script>
    function myFunction() {
    var dateFormat = "dd/MM/yyyy";
    params = {
    aras: top.aras,
    format: dateFormat,
    type: "Date"
    };
    return aras.getMainWindow().main.ArasModules.Dialog.show("iframe", params).promise.then(function(res) {
    return updateDatetoText(res);
    });
    function updateDatetoText(dt) {
    var queryDate = dt.replace(" ", "T");
    var fillFromDate = document.querySelector("input[name='date']");
    fillFromDate.value = queryDate;
    }
    }
    </script>

    Thank You

    Gopikrishnan R