下面介绍如何使用bootstrap实现年月日的时间选择。
使用bootstrap实现时间选择,页面需要加载以下文件:(推荐学习:bootstrap视频教程)
1、css文件:bootstrap.min.css、bootstrap-datetimepicker.min.css
2、js文件:jquery-1.8.3.min.js、bootstrap.min.js、bootstrap-datetimepicker.js、bootstrap-datetimepicker.zh-cn.js
使用bootstrap实现年份的选择。
bootstrap配置代码如下:
<script type="text/javascript">$('.form_datetime').datetimepicker({ language: 'zh-cn', minview: 4, format: 'yyyy', startdate:2019, autoclose: 1, startview: 4,});</script>
使用bootstrap实现月份的选择。
bootstrap配置代码如下:
<script type="text/javascript">$('.form_datetime').datetimepicker({ format: 'mm', autoclose:true, startview:3, minview:3, maxview:3, initialdate:new date(), language:'zh-cn'});</script>
使用bootstrap实现年月日的选择。
bootstrap配置代码如下:
<script type="text/javascript">$('.form_datetime').datetimepicker({ format: 'yyyymmdd', weekstart: 1, autoclose: true, startview: 2, minview: 2, language:'zh-cn'});</script>
实现的效果如下:
更多bootstrap相关技术文章,请访问bootstrap教程栏目进行学习!
以上就是如何使用bootstrap实现年月日的时间选择的详细内容。