【问题标题】:Google Script Editor - Cannot find method formatDate(string,string,string)Google 脚本编辑器 - 找不到方法 formatDate(string,string,string)
【发布时间】:2017-11-07 04:52:51
【问题描述】:

这是昨天工作的,然后今天就因为错误“找不到方法 formatDate(string,string,string).”而退出工作。知道为什么会这样吗?

var today = new Date();
sheetArchive.getRange('X3:X3').setValue(Utilities.formatDate(today, Session.getScriptTimeZone(), "yyyy-MM-dd HH:mm:ss")); // date submitted

【问题讨论】:

  • 你的脚本部署了吗?
  • 那里看起来没有什么问题。你能提供一个minimal reproducible example吗?
  • 为了调试目的,将链式代码分成多行。找到问题后,您可以将其全部放回一行。这可能是不正确的错误消息。这可能是暂时的服务中断。这可能是一个错误。无论如何,您都需要了解更多信息。
  • 也可以复制。调用 Utilities.formatDate(new Date(), x, y) 有效,Utilities.formatDate(today, x, y) 失败并显示相同的错误消息。
  • 在我的情况下这是愚蠢的语法错误。我不小心调用了没有参数的方法,并将这个空参数作为 formatDate() 第一个参数传递。

标签: google-apps-script


【解决方案1】:

Google 一定有错误,我没有更改任何内容,然后第二天它又开始工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-24
    • 2016-11-06
    • 2017-05-03
    • 2019-11-22
    相关资源
    最近更新 更多