如何在 Google 应用程序脚本中定义今天的日期?
How to define today date in Google app script?
我正在为特定任务在我的应用程序脚本中定义 date = new Date();
.
.
.
old_date < today_date
。
任务是在 old_date < today_date 时发送电子邮件。但它的工作过程是 old_date <= today_date。我怎样才能写出确切的查询?非常感谢任何帮助。
*点(.)是其他代码语句。
Date currentDate = new Date() 为您提供现在的时间。
old-date < currentDate 对于调用 new Date() 之前发生的所有事情都为真。
因此一个小时前发生的事情也会被调用。
您希望 currentDate 为今天 00:00 am。
这可以通过以下方式完成:
var d = new Date();
d.setHours(0,0,0,0);
如果您 运行 遇到某些问题,请记住时区。
currentDate= newDAte() 从这里你可以定义今天的日期
我正在为特定任务在我的应用程序脚本中定义 date = new Date();
.
.
.
old_date < today_date
。
任务是在 old_date < today_date 时发送电子邮件。但它的工作过程是 old_date <= today_date。我怎样才能写出确切的查询?非常感谢任何帮助。
*点(.)是其他代码语句。
Date currentDate = new Date() 为您提供现在的时间。
old-date < currentDate 对于调用 new Date() 之前发生的所有事情都为真。 因此一个小时前发生的事情也会被调用。
您希望 currentDate 为今天 00:00 am。 这可以通过以下方式完成:
var d = new Date();
d.setHours(0,0,0,0);
如果您 运行 遇到某些问题,请记住时区。
currentDate= newDAte() 从这里你可以定义今天的日期