my97datePick基础用法

1.显示年月日

<input type="text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss')">

2.限制今天以后的日期不能选择

<input type="text" onClick="WdatePicker({maxDate:'%y-%M-%d')">

3.选择时间段

<input type="text" onClick="WdatePicker({dateFmt:'HH:mm:ss')">

4.开始时间不能大于结束时间

  <input id="startTime"  value=""     type="text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endTime\')}'})" name="startTime" class="Wdate"/>-

 <input id="endTime"  value=""     type="text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startTime\')}'})" name="endTime" class="Wdate"/>

5.开始时间不大于结束时间,且结束时间不小于开始时间

<input type="text" class="abnormalHight timeBtn " value="" id="starTime" name="beginDate" onclick="WdatePicker({minDate:'',maxDate:'#F{$dp.$D(\'endTime\')}'});" placeholder="选择时间" autocomplete='off'/>

<input type="text" value=""  class="abnormalHight timeBtn " id="endTime"  name="endDate" onclick="WdatePicker({minDate:'#F{$dp.$D(\'starTime\')}', maxDate:'%y-%M-%d'});" autocomplete='off' />	


<script><
function timestampToTime(timestamp) {
					var date = new Date(timestamp * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
					var Y = date.getFullYear() + '-';
					var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
					var D = date.getDate() + ' ';
					var h = date.getHours() + ':';
					var m = date.getMinutes() + ':';
					var s = date.getSeconds();
					return Y + M + D;
			};
		
					var nowDate = new Date();
					var year = nowDate.getFullYear();
					var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) : nowDate.getMonth() + 1;
					var day = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
					var datetime = year + "-" + month + "-" + day; // "2018-03-26";
				    $("#endTime").val(datetime);
				    $("#starTime").val(datetime);
					var numberdate = new Date(datetime).getTime() / 1000;
					var startValue =timestampToTime(numberdate - 7948800) ;




/script>

 

 

后续有使用持续更新

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值