I want to add date picker with time in configuration section in my custom module.

I followed Webkul link

webkul link

But from this I can only able to see date picker time picker is not appearing. How I will add time picker?


1 Answer 1


You should use the datetimepicker like this:

$html .= '<script type="text/javascript">
        require(["jquery", "jquery/ui"], function (jq) {
            jq(document).ready(function () {
                jq("#' . $element->getHtmlId() . '").datetimepicker( { dateFormat: "dd/mm/yy" } );
                    jq("#' . $element->getHtmlId() . '").focus();
// return datetime picker element



  • in my case it's not working i am use same code from webkul and replace script from above script still i can't get time in datepicker. Aug 22, 2017 at 13:15
  • @SanjayGohil try to clean a cache Aug 22, 2017 at 13:30
  • prntscr.com/gbmw68 check this screen shot i am doing anything wrong ? Aug 22, 2017 at 13:37
  • @SanjayGohil Seems that all is ok. Could you share a complete module somewhere on github or bitbucket? Aug 22, 2017 at 14:11
  • 4
    adding mage/calendar to the DI array of requirejs make it working in magento 2.2 Jan 12, 2018 at 4:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.