【发布时间】:2018-01-13 11:22:17
【问题描述】:
我使用这部分代码(以及时间触发器)在“工作时间”每 5 分钟运行一次脚本,但现在我需要一些调整
function officeHours(){
var nowH=new Date().getHours();
var nowD=new Date().getDay();
Logger.log('day : '+nowD+' Hours : '+nowH)
if(nowH>17||nowH<8||nowD==6||nowD==0){return}
Browser.msgBox('time to work !');//normally your real function should begin here...
}
但是如何更具体呢?例如将工作时间设置为 8:30 到 17:30 或其他时间,例如班次(工作时间)从一天开始到第二天结束(从第一天的22:30到第二天的06:30)?
【问题讨论】:
标签: time google-apps-script triggers