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

限于喜欢 提交于 2019-12-13 19:27:18

问题


I need to set a starting date in datetimepicker. how can i do that ? I checked with minDate and StartDate. But i couldn't able to set the starting date. Please give me a propper solution for this. Thanks in advance.

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
}); 

回答1:


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
}); 



回答2:


Try

defaultDate : 'your date here',
minDate : 0



回答3:


Thank you Guys.. I solve this with following.. Now Its working fine for me.

jQuery('#filterStartDate').datetimepicker({ timepicker:false, format:'m/d/Y', minDate:'-#startDate#' });



来源:https://stackoverflow.com/questions/24637150/how-to-set-a-starting-date-in-jquery-datetimepicker-taken-from-a-query-using-col

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!