kendo ui - DatePicker 日期时间系列
kendo-ui 官网:https://www.telerik.com/documentation
初始化 grid:
引入文件:
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.516/styles/kendo.common.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.516/styles/kendo.rtl.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.516/styles/kendo.silver.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.516/styles/kendo.mobile.all.min.css"/> <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.2.516/js/kendo.all.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.2.516/js/kendo.culture.zh-CN.min.js"></script> <!-- 汉化日期 -->
1. 定义日期时间:
创建时间盒子:
<div class="content" style="width: 400px;margin: 50px auto;border: 1px solid #ccc;padding: 20px;">
<h4>开始时间:</h4>
<input id="start" style="width: 100%;" value="2018/01/01" />
<h4 style="margin-top: 2em">结束时间:</h4>
<input id="end" style="width: 100%;" value="2018/01/01"/>
</div>
定义js:
$(document).ready(function() {
kendo.culture("zh-CN"); //需声明汉化
function startChange() {
var startDate = start.value(),
endDate = end.value();
if (startDate) {
startDate = new Date(startDate);
startDate.setDate(startDate.getDate());
end.min(startDate);
} else if (endDate) {
start.max(new Date(endDate));
} else {
endDate = new Date();
start.max(endDate);
end.min(endDate);
}
}
function endChange() {
var endDate = end.value(),
startDate = start.value();
if (endDate) {
endDate = new Date(endDate);
endDate.setDate(endDate.getDate());
start.max(endDate);
} else if (startDate) {
end.min(new Date(startDate));
} else {
endDate = new Date();
start.max(endDate);
end.min(endDate);
}
}
var start = $("#start").kendoDatePicker({
change: startChange,
format: "yyyy/MM/dd" //定义时间格式 例如yyyy-MM-dd , dd/mm/yyyy , MMMM yyyy等
}).data("kendoDatePicker");
var end = $("#end").kendoDatePicker({
change: endChange,
format: "yyyy/MM/dd"
}).data("kendoDatePicker");
start.max(end.value());
end.min(start.value());
});

2.定义详细时间:
创建时间盒子:
<div class="content" style="width: 400px;margin: 50px auto;border: 1px solid #ccc;padding: 20px;">
<h4>开始时间:</h4>
<input id="start" style="width: 100%;" />
<h4 style="margin-top: 2em;">结束时间:</h4>
<input id="end" style="width: 100%;" />
</div>
定义js:
$(document).ready(function() {
function startChange() {
var startDate = start.value(),
endDate = end.value();
if (startDate) {
startDate = new Date(startDate);
startDate.setDate(startDate.getDate());
end.min(startDate);
} else if (endDate) {
start.max(new Date(endDate));
} else {
endDate = new Date();
start.max(endDate);
end.min(endDate);
}
}
function endChange() {
var endDate = end.value(),
startDate = start.value();
if (endDate) {
endDate = new Date(endDate);
endDate.setDate(endDate.getDate());
start.max(endDate);
} else if (startDate) {
end.min(new Date(startDate));
} else {
endDate = new Date();
start.max(endDate);
end.min(endDate);
}
}
var today = kendo.date.today();
var start = $("#start").kendoDateTimePicker({
value: today,
change: startChange,
format: "yyyy-MM-dd hh:mm tt" //定义时间格式
}).data("kendoDateTimePicker");
var end = $("#end").kendoDateTimePicker({
value: today,
change: endChange,
format: "yyyy-MM-dd hh:mm tt"
}).data("kendoDateTimePicker");
start.max(end.value());
end.min(start.value());
});

关于时间格式 详细参考:
https://docs.telerik.com/kendo-ui/framework/globalization/dateformatting
kendo ui - DatePicker 日期时间系列的更多相关文章
- layDate/DatePicker日期时间空间
真心不错,果断收藏了. 1.示例与效果 2.更多示例与皮肤 补充说明:My97DatePicker日期时间插件 的使用 1.示例与效果 2. 更多 常用的实例:WdatePicker下载 http:/ ...
- kendo ui - grid 数据表格系列
kendo-ui 官网:https://www.telerik.com/documentation 初始化 grid: 引入文件: <link rel="stylesheet" ...
- kendo ui - MultiSelect 多选系列
kendo-ui 官网:https://www.telerik.com/documentation 初始化 grid: 引入文件: <link rel="stylesheet" ...
- kendo ui DatePicker 时区转换
http://blog.darkthread.net/post-2013-06-25-json-date-timezone-issue.aspx
- Kendo UI使用笔记
1.Grid中的列字段绑定模板字段方法参数传值字符串加双引号: 上图就是个典型的例子,openSendWin方法里Id,EmergencyTitle,EmergencyDetail 三个参数,后两个参 ...
- 构建的Web应用界面不够好看?快试试最新的Kendo UI R3 2019
通过70多个可自定义的UI组件,Kendo UI可以创建数据丰富的桌面.平板和移动Web应用程序.通过响应式的布局.强大的数据绑定.跨浏览器兼容性和即时使用的主题,Kendo UI将开发时间加快了50 ...
- Kendo UI for jQuery使用教程:入门指南
[Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...
- Kendo UI使用教程:入门指南
[Kendo UI最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support for React和 ...
- 「版本升级」界面控件Kendo UI正式发布R2 2019|附下载
通过70多个可自定义的UI组件,Kendo UI可以创建数据丰富的桌面.平板和移动Web应用程序.通过响应式的布局.强大的数据绑定.跨浏览器兼容性和即时使用的主题,Kendo UI将开发时间加快了50 ...
随机推荐
- spring Controller 层注解获取 properties 里面的值
前言:最近在做一个项目,想要在 controller 层直接通过注解 @Value("")来获取 properties 里面配置的属性. 这个其实和 springmvc.sprin ...
- git常用命令和场景
总结: git init //初始化本地git环境 git clone XXX//克隆一份代码到本地仓库 git pull //把远程库的代码更新到工作台 git pull --rebase orig ...
- 查看Linux 、Nginx、 MySQL 、 PHP 版本的方法
参考:查看Linux .Apache . MySQL . PHP 版本的方法 1.查看Linux版本: uname -a: more /etc/issue; cat /proc/version; 2. ...
- MySQL的索引与优化
写在前面:索引对查询的速度有着至关重要的影响,理解索引也是进行数据库性能调优的起点.考虑如下情况,假设数据库中一个表有10^6条记录,DBMS的页面大小为4K,并存储100条记录.如果没有索引,查询将 ...
- 报表在IBM AIX系统下resin部署
报表是用java开发的,具有良好的跨平台性.不仅可以应用在windows.linux.操作系统,还可以应用在AIX等等的unix操作系统.在各种操作系统上部署过程有一些差别.下面说一下在AIX操 ...
- 最常见到的runtime exception 异常
ArithmeticException, 算术异常ArrayStoreException, 将数组类型不兼容的值赋值给数组元素时抛出的异常BufferOverflowException, 缓冲区溢出异 ...
- 解决eclipse 文件更新不自动刷新的问题
打开eclipse 1. Window ===> Preferences ===> General ===> Workspace 2. 勾选 1> Refresh using ...
- 转:HTTP Status 404(The requested resource is not available)的几种解决方法
原文地址 原因:servlet没有配置正确 ,查看web.xml确认正确,以及自己的请求路径正确 在IE中提示“404”错误有以下三种情况 1.未部署Web应用 2.URL输入错误 排错方法: 首先, ...
- Python基础第一篇-------python的介绍
一.python的介绍 python的创始人为吉多·范罗苏姆(Guido van Rossum).1989年的圣诞节期间,吉多·范罗苏姆(中文名字:龟叔)为了在阿姆斯特丹打发时间,决心开发一个新的脚本 ...
- SQL脚本运行
$v=New-Object -ComObject wscript.shell#也可以使用反单引号(`)字符来强制PowerShell将单引号或双引号解释为文本,0不显示命令提示符窗口$v.run(&q ...