Search code examples
twitter-bootstrapdatetimepickerbootstrap-datetimepickereonasdan-datetimepicker

Bootstrap datetimepicker:: how to set minimum year?


i'm using bootstrap datetimepicker. And i have a field to select year in my form. Actually it is just for selecting the year in YYYY format(4 digit) . And i'm inserting the selected 4 digit year in MySQL. In mysql database, I'm using year Type for the column. According to the MySQL Reference,

YEAR(4) and YEAR(2) differ in display format, but have the same range of values. For 4-digit format, MySQL displays YEAR values in YYYY format, with a range of 1901 to 2155, or 0000.

so i need to disable the years before 1900 in the bootstrap datetimepicker.

Here is the image of the datetimepicker that i'm using now.

bootstrap datetimepicker


Solution

  • Try this:

    $('#datetimepicker').datetimepicker(minDate : '1900-01-01');
    

    Check codepen: http://codepen.io/anon/pen/mVOjRQ