Select Dates & Times From Form Fields - jQuery moDateTimeField

File Size: 19.6 KB
Views Total: 1633
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Select Dates & Times From Form Fields - jQuery moDateTimeField

moDateTimeField is a simple, convenient, mobile-compatible jQuery DateTime picker plugin for the web. Licensed under The GNU General Public License v3.0.

The plugin enables the user to pick dates and times from Year, Month, Day, Hour, Minutes, Secondes form fields, with data validation and SQL preformatting.

How to use it:

1. Create a regular input field that stores the date and time you select.

<input type="text" name="exemple" id="exemple" class="datetime-field" value="2018-08-21">

2. Insert jQuery library and the moDateTimeField plugin into the HTML file.

<script src="" 
<script src="moDatetimeField.js"></script>

3. Call the function on the input field.


4. This will generate date fields as these:

<div class="modatetime-field-container" data-function="date" data-is-sql="1">
  <div class="modatetime-field-wrapper modatetime-year">
    <label for="exemple__datetime_field_year">Year</label>
    <input type="text" maxlength="4" id="exemple__datetime_field_year" name="exemple__datetime_field_year" data-field="year" data-default="2018" data-form-field="exemple" value="2018" placeholder="YYYY">
  <div class="modatetime-field-wrapper modatetime-month">
    <label for="exemple__datetime_field_month">Month</label>
    <input type="hidden" mxlenght="2" id="exemple__datetime_field_month" name="exemple__datetime_field_month" data-field="month" data-default="01" data-form-field="exemple" value="08">
      <option value="1">January</option>
      <option value="2">February</option>
      <option value="3">March</option>
      <option value="4">April</option>
      <option value="5">May</option>
      <option value="6">June</option>
      <option value="7">July</option>
      <option value="8" selected="selected">August</option>
      <option value="9">September</option>
      <option value="10">October</option>
      <option value="11">November</option>
      <option value="12">December</option>
  <div class="modatetime-field-wrapper modatetime-day">
    <label for="exemple__datetime_field_day">Day</label>
    <input type="text" maxlength="2" id="exemple__datetime_field_day" name="exemple__datetime_field_day" data-field="day" data-default="01" data-form-field="exemple" value="21" placeholder="DD">
<input type="text" name="exemple" id="exemple" class="datetime-field" value="2018-08-21">

5. To enable time fields, call the moDatetimeField function instead.


6. Enable/disable the SQL preformating functionality.


7. Customize the date/time format.

  format:'d-m H:i:s'

This awesome jQuery plugin is developed by MOWebCreation. For more Advanced Usages, please check the demo page or visit the official website.