1.html

<input type="text" id="startTime" name="startTime" class="form-control" placeholder="开始时间">
<input type="text" id="endTime" name="endTime" class="form-control" placeholder="结束时间">

2.laydate的使用,控制开始日期的最大日期为当前日期。结束时间的范围为开始时间到当前日期。

//laydate日期
var startDate = laydate.render({
elem: '#startTime', //指定元素
type: 'datetime',
max:getNowFormatDate(),
done: function (value, dates) {
endDate.config.min ={
year:dates.year,
month:dates.month-1, //关键
date: dates.date,
hours: 0,
minutes: 0,
seconds : 0
};
}
});
var endDate = laydate.render({
elem: '#endTime', //指定元素
type: 'datetime',
max:getNowFormatDate()
});
//获取当前的日期时间 格式“yyyy-MM-dd HH:MM:SS”
function getNowFormatDate() {
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
+ " " + date.getHours() + seperator2 + date.getMinutes()
+ seperator2 + date.getSeconds();
return currentdate;
}

  

最新文章

  1. nmon工具的安装及简单使用
  2. SharePoint 2013 搭建负载均衡(NLB)
  3. HTML5实践 -- 使用CSS3 Media Queries实现响应式设计
  4. JS中插入节点的方法appendChild和insertBefore的应用
  5. C#委托实例
  6. jQuery.isNumeric() 和 js isNaN()
  7. 解决JQuery中datatables设置隐藏显示列多次提交后台刷新数据的问题
  8. Hello ReactJS
  9. 在 WebSphere Application Server V7 集群环境中管理 HTTP session[阅读]
  10. C陷阱和缺陷学习笔记
  11. 阿里云服务器Linux CentOS安装配置(11)安装Wordpress
  12. SQL Server实现读写分离提高系统并发
  13. web项目中添加MySQL驱动
  14. Docker技术入门与实战 第二版-学习笔记-6-仓库
  15. POJ 3666 Making the Grade(二维DP)
  16. List,Set的区别
  17. redhat 7.2更新yum源时踩的坑
  18. Linux将程序添加到服务的方法(通用)
  19. [Agc001E] BBQ Hard
  20. ElasticSearch基本查询

热门文章

  1. 在虚拟机安装Oracle,在本地电脑上运行sql develer出现ora-12514
  2. C语言提高 (7) 第七天 回调函数 预处理函数DEBUG 动态链接库
  3. 记Spring搭建功能完整的个人博客「Oyster」全过程[其一] 整体思路:需求、架构及技术要求
  4. NOI 2016 循环之美 (莫比乌斯反演+杜教筛)
  5. python中的各个包的安装,用pip安装whl文件
  6. gem update --system
  7. linux下測试硬盘读写速度
  8. Struts2值栈的相关操作
  9. Beginning Python From Novice to Professional (9) - Socket
  10. Swift3.0 闭包整理