日期组件初始化

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ZHOU_VIP/article/details/89226427

不带时分秒,jsp中引入:

<!-- bootstrap time picker -->

<script src="<%=path%>/plugins/timepicker/bootstrap-timepicker.min.js"></script>

带时分秒,jsp中引入:

<!-- bootstrap time picker -->

<script src="<%=path%>/plugins/datetimepicker/bootstrap-datetimepicker.min.js"></script>


/**
 * 日期组件初始化.
 * 
 * @returns
 */
function initdatePicker(){
    //不带时分秒
    /*$('#dev_form_postingdate').datepicker({
        autoclose: true,
        format: 'yyyy-mm-dd'
      });*/

    //带时分秒
    $('#dev_form_postingdate').datetimepicker({
        autoclose: true,
        format: 'yyyy-mm-dd hh:ii:ss'
     });
}
/**
 * 日期组件初始化.
 * 
 * @returns
 */
function initdatePicker(){
    //查询里面的日期初始化
    $('#dev_lc_qrybt').datepicker({
        autoclose: true,
        format: 'yyyy-mm-dd'
    });    
    $('#dev_lc_qryet').datepicker({
        autoclose: true,
        format: 'yyyy-mm-dd'
    });
    //详情里面的日期初始化
    $('#dev_form_contractdate').datetimepicker({
        autoclose: true,
        format: 'yyyy-mm-dd hh:ii:ss'
    });
   
}
/**
 * 日期组件初始化.
 * 
 * @returns
 */
function initdatePicker(){
    $('#gprs_rpt_topn_bt').datepicker({
        autoclose: true,
        format: 'yyyy-mm-dd'
      });    
    $('#gprs_rpt_topn_et').datepicker({
        autoclose: true,
        format: 'yyyy-mm-dd'
      });
    var curDate = new Date();
    $('#gprs_rpt_topn_et').val(curDate.format("yyyy-MM-dd"));    
    var curTs = curDate.getTime();
    curDate.setTime(curTs - 7*24*3600*1000);
    $('#gprs_rpt_topn_bt').val(curDate.format("yyyy-MM-dd"));	
}

猜你喜欢

转载自blog.csdn.net/ZHOU_VIP/article/details/89226427