日期:2014-05-16 浏览次数:20364 次
<input type="text" id="ks" value="2013-11-11 00:15" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'#F{$dp.$D(\'js\',{H:3});}'})"/>
<input type="text" id="js" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',maxDate:'#F{$dp.$D(\'ks\',{H:-3});}'})"/>
<script type="text/javascript">
window.onload=function(){
var t = document.getElementById("ks").value+":00";//获取 id=ks的完整时间;
var d = new Date(t.replace(/-/g,"/"));//赋值时间对象
d.setHours(d.getHours()-3);//减去3小时
document.getElementById("js").value = d.getFullYear()+"-"+(d.getMonth()+1)+"-"+ d.getDate()+" "+ d.getHours()+":"+ d.getMinutes();
}
</script>