JS时间的计算,当前日期加一天或者几天的计算
//alert();
//debugger;
var newriqi="";
var jjd=defaultForm.getCellById(sjyxjid).getText();
var times=defaultForm.getCellByName("建单时间").getText();
if(jjd==""){
defaultForm.getCellByName("事件完成期限").setText("");
}else {
var j=0;
var addtime=0;
var newtime="";
var now=new Date(Date.parse(times));
var jday=now.getDay();//获取当前日期的为星期几
if(jjd=="紧急"){
j=1;
addtime=4//定义4小时解决时间
}else if (jjd=="高") {
j=1;
addtime=8
}else if (jjd=="中") {
j=2;
addtime=24;
}else {
j=3;
addtime=24;
}
//for ( var i = 1; i <= j; i++) {
// var aa=now.setTime(now.getTime()+1*addtime*3600*1000);//进行天数的运算
// //alert(aa);
// var xqj=now.getDay();//判断是星期几;.
// //alert(xqj);
// if(xqj==6){//6表示是星期六,星期天表示是周日;
// var bb=now.setTime(now.getTime()+2*24*3600*1000);
// // alert(bb)
// }
// if(xqj==0){
// now.setTime(now.getTime()+1*24*3600*1000);
// }
//}
now.setTime(now.getTime()+j*addtime*3600*1000);//进行天数的运算
var xqj=now.getDay();//判断是星期几;
//alert("jday="+jday+"%%%xqj="+xqj);
if(xqj==6 || xqj==0 || (jday>xqj && jday!=0)){//6表示是星期六,星期天表示是周日;
now.setTime(now.getTime()+2*24*3600*1000);
}
// if(xqj==0){
// now.setTime(now.getTime()+1*24*3600*1000);
// }
newtime= now.format("yyyy-MM-dd hh:mm:ss");//格式化日期
defaultForm.getCellByName("事件完成期限").setText(newtime.substring(0, 16));
}
}
JS时间的计算,当前日期加一天或者几天的计算的更多相关文章
- 如何使用dos命令打开当前用户、当前日期、当前时间以及当前用户加当前时间?
1.dos命令安装mysqld --stall.启动net start mysql.进入MySQL数据库mysql -uroot -p后,输入select user();当前用户 select cur ...
- JS 时间处理(GMT转换,超24小时加一天,时间差计算)
计算天数,加小时,加分数 Date.prototype.Format = function (fmt) { // author: meizz var o = { "M+": thi ...
- oracle用于判断时间条件为当天的写法(当前日期加一天)
trunc(sysdate + 1, 'dd')为当前日期加一天: 来自: and wf.start_time between sysdate and trunc(sysdate + 1, 'dd') ...
- js浮点数计算(加,减)
最近工作中经常遇到需要处理浮点型计算的问题,开始一直都在用把浮点数先乘以10的对应小数的位数的次方化成整数再去开始计算. 例如100.01+100.02,可以化成(100.01*100+100.02* ...
- js 时间相关函数
实例: <!doctype html> <html> <head> <meta charset="utf-8"> <title ...
- js 时间处理
1.格式化时间 function GetDateTimeFormatter(value) { if (value == undefined) { return &q ...
- js获取当前时间,js时间函数
Js获取当前日期时间及其它操作,js时间函数 var myDate = new Date(); myDate.getYear(); //获取当前年份(2位) myDate.getFullYear(); ...
- js 时间函数 及相关运算大全
js 时间函数 及相关运算大全 var myDate = new Date(); myDate.getYear(); //获取当前年份(2位) myDate.getFullYear(); ...
- js时间基本操作
js 获取前一天的时 var today=new Date(); var yesterday_milliseconds=today.getTime()-1000*60*60*24; var yeste ...
随机推荐
- day05
1.递归 利用递归实现阶乘(1*2*3*4*5*6*7) def func(num): if num == 1: return 1 return num * func(num-1) x = func( ...
- infinite-scroll插件无限滚动加载数据的使用
网上对于infinite-scroll插件使用的例子不多.但由于它的出现,鼓吹了瀑布流形式的页面展示方式,所以不得不了解了解这种新的分页方式. 官网上有对infinite-scroll的详细描述,但一 ...
- 【Maven实战】archetype的使用和eclipse的配置
1.之前在进行项目的构建时都是使用手工进行文件夹的建立,maven也给我们提供了一个参数archetype,可以用来进行项目骨架的建立.使用maven archetype:generate进行创建: ...
- SCLButton
import UIKit let kSuccessTitle = "Congratulations" let kErrorTitle = "Connection erro ...
- MIUI是小米的核心竞争力
MIUI与众多顶尖的互联网公司合作开发系统功能,题主说的很不完全,当然估计除了MIUI开发组也没人能说的很完整,我试着总结了一下,欢迎补充: 1.云服务:金山云(小米公司持有金山云公司9.87%的股份 ...
- 夏梦竹谈Hive vs. HBase的区别
对于刚接触大数据的用户来说,要想区分Hive与HBase是有一定难度的.本文将尝试从其各自的定义.特点.限制.应用场景等角度来进行分析,以作抛砖引玉之用. Hive是什么? Apache Hive是 ...
- 两个bootstrap插件bootstrap-select和bootstrap-paginator
基于bootstrap的选择器 http://silviomoreto.github.io/bootstrap-select/ <label for="androids" c ...
- Types of AOP
There are two distinct types of AOP: static and dynamic. The difference between them is really the p ...
- HDU_1401——同步双向BFS,八进制位运算压缩,map存放hash
这个速度比分步快一点,内存占的稍微多一点 Problem Description Solitaire is a game played on a chessboard 8x8. The rows an ...
- LeetCode-Add Two Binary
Add BinaryApr 2 '12 3558 / 10570 Given two binary strings, return their sum (also a binary string). ...