jquerydatetimepicker

How do I set a starting date in Jquery datetimepicker taken from a query using coldfusion?


I need to set a starting date in datetimepicker. How can I do that ? I checked with minDate and StartDate. But I couldn't set the starting date.

Sample Code :

StartDate = new Date("March 20, 2014");
jQuery('.datetimepicker').datetimepicker({step:30});
jQuery('.datetimepicker_notime').datetimepicker({
        timepicker:false,
        format:'m/d/Y',
        minDate : StartDate,
        step:30
}); 

Solution

  • According to the docs for this jQuery plugin (if this is the one that you are using) the start date can be set like this:

    Date Time Picker start date #

    javaScript

    jQuery('#datetimepicker_start_time').datetimepicker({
        startDate:'1971/05/01'
    });
    

    startDate - if input value is empty, calendar set date from this starDate

    examples:

    {startDate:'1987/12/03'}
    {startDate:new Date()}
    {startDate:'+1970/01/02'} // tomorrow
    {startDate:'08.12.1986',formatDate:'d.m.Y'}
    

    Adding this to your example it would look like this:

    StartDate = '2014/03/20';
    jQuery('.datetimepicker').datetimepicker({step:30});
    jQuery('.datetimepicker_notime').datetimepicker({
        timepicker:false,
        format:'m/d/Y',
        startDate: StartDate,
        step:30
    });