我需要在代码中更正此行错误,但是当我运行'脚本没有报告错误

时间:2014-08-14 03:01:43

标签: google-apps-script timezone

第54-56行:

54 -     if (today == Utilities.formatDate(files[i].getLastUpdated(), "EST", "yyyy-MM-dd")) 
         {
55 -     Logger.log("  -> File was modified today. Getting word count...");
56  -    word_count += getFileWordCount(files[i].getId());
来自Google的

错误消息显示:

  

getDailyWordCount错误值(第55行,文件“代码”)基于时间

我认为问题在于“EST”,因为我不在那个时区。我在GMT + 3:00

这是脚本以及它应该如何运作 - https://github.com/jamietr1/google-docs-writing-tracker

1 个答案:

答案 0 :(得分:0)

您是否尝试将时区更改为:

  1. getScriptTimeZone()
  2. 使用时区作为以下格式记录的格式:http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.htmlhttp://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#timezone