jquery日期控件+时分秒

因为项目需要,一些时间上的查询要精确的时分.先看下效果图吧。

所需要的js 跟css 文件

jsp://特别注意引入的先后顺序

<link rel="stylesheet" href="${pageContext.request.contextPath }/css/jqueryui/jquery-ui-timepicker-addon.css">
<link rel="stylesheet" href="${pageContext.request.contextPath }/css/jqueryui/demos.css">
<link rel="stylesheet" href="${pageContext.request.contextPath }/css/jqueryui/jquery-ui.css">

<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jqueryui/jquery-ui.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jqueryui/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jqueryui/jquery-ui-timepicker-zh-CN.js"></script>

$(function(){($('#startDate').datetimepicker({

changeMonth: true,  月份可更改     

 changeYear: true, //年可更改

 timeFormat: "HH:mm:ss",//时分秒显示格式

 dateFormat: "yy-mm-dd",//年月日显示格式

  dayNamesMin: [ "七","一", "二", "三", "四", "五", "六"],//一周中文显示       

  monthNamesShort: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"],//月份中文显示

    stepHour: 2, //时间选择隔2小时,可选择      

    stepMinute: 10,       

    stepSecond: 10,//步长

showHour:true,//是否显示小时

showMinute:true,

showSecond:true,

});
});

到此就可以完成啦。

原文地址:https://www.cnblogs.com/cbdd/p/5506080.html