zl程序教程

您现在的位置是:首页 >  前端

当前栏目

Bootstrap datetimepicker “dp.change” 时间/日期 选择事件

Bootstrap事件日期 时间 选择 DP Change
2023-09-14 08:57:26 时间
$('#<!--{$inputId}-->').datetimepicker({
  todayHighlight: true,
  format: "YYYY-MM-DD<!--{if $isTime}--> HH:mm<!--{/if}-->",
  pickTime: <!--{if $isTime}-->true<!--{else}-->false<!--{/if}-->,
  minuteStepping: <!--{$minuteStepping}-->,
  language: 'zh-CN',
  inputMask: true,
  inline: true,
  sideBySide: true,
  pickerPosition:'bottom-right'
}).bind('dp.change', function(e) {
  var d = new Date(e.date);

  console.log(d.getFullYear()); // 年
  console.log(d.getMonth() + 1); // 月
  console.log(d.getDate()); // 日期

}).next().on(ace.click_event, function(){
  $(this).prev().focus();
});

 

 

参考:

http://stackoverflow.com/questions/39247347/bootstrap-datetimepicker-dp-change