1. Home
  2. Articles
  3. Web Design
  4. JavaScript
  5. jQuery UI
  6. jQuery Date and Time Picker
Read about jquery datetime picker

jQuery Date and Time Picker




During the initial development of the administrative tools for this site, I required a date and time field to represent the published, created and last modified dates. Due to time constraints, I just tossed on the default date picker included with the jQuery UI library. The problem with this solution is that it doesn't support selection of time, only dates. Time to find a better solution.


To address the time part of the datetime picker, I looked for a small plugin that offered the ability to display time in mulitple formats including 12 hour, AM/PM and ISO 8601 format. After testing few solutions I settled on XDsofts DateTimePicker jQuery plugin.


I only ran into one issue in implementation that wasn't documented very well in the examples and opitions list. By providing both a "format" and "timeFormat" I was able to get the plugin to display a human readable calendar and 12 hour AM/PM time selection. The output to the visible field worked directly into the ISO 8601 format I required. Here is the code.

<input id="txtArticleDateCreated" name="txtArticleDateCreated" type="text" autocomplete="off" />

<script src="/js/datetimepicker/jquery.datetimepicker.full.min.js"></script>
<link rel="stylesheet" type="text/css" href="/js/datetimepicker/jquery.datetimepicker.min.css" >
      format:'Y-m-d H:i:s',
      formatTime:'h:i a'

I also found that adding the input element autocomplete value off removed Chromes autocomplete that kept blocking the selection box.


Profile Picture of Bryan Myers - The Web Guy

Bryan Myers - "The Web Guy"

Advanced Digital Channel Engineer


  1. Articles discussing web related topics and technologies.Articles
  2. Articles about Web Design.Web Design
  3. Articles relating to JavaScript and its usage in website design and interactive development.JavaScript
  4. Information about the jQuery UI plugin.jQuery UI

Related Articles

Go Back