Google脚本-来自表单输入的格式日期

问题描述 投票:0回答:1

作为序言,我对此很陌生,但是我目前有一个脚本,该脚本根据对Google表单的输入来输出Google Doc / PDF。

[PDF每次提交新表单时都会输出,当前日期的格式为DD / MM / YY,但我希望它以dd MMMM yyyy的形式显示,即2020年5月19日,而不是19/05/20。] >

我尝试使用以下方法更改格式

var signDate = e.values[1];
var formatSignDate = Utilities.formatDate(signDate, "GMT+1", "dd MMMM yyyy");
body.replaceText('{{Execution Date}}', formatSignDate);

但是出现以下错误

异常:参数(字符串,字符串,字符串)与Utilities.formatDate的方法签名不匹配。在autoFillFromForm(Code:17:28)

我在做什么错?我不能将.formatDate与工作表单元格中的日期一起使用吗?

编辑:带有signDate日志的错误消息

Stackdriver日志信息signDate = 20/05/2020错误异常:参数(String,String,String)与以下方法的签名不匹配Utilities.formatDate。在autoFillFromForm(Code:23:34)

开头,我对此很陌生,但是我目前有一个脚本,该脚本根据对Google表单的输入来输出Google Doc / PDF。只要提交新表格,即当前...

date google-apps-script google-sheets google-form
1个回答
1
投票

异常:参数(字符串,字符串,字符串)与Utilities.formatDate的方法签名不匹配

© www.soinside.com 2019 - 2024. All rights reserved.