脚本时区问题

时间:2019-05-27 12:53:41

标签: google-apps-script google-sheets

在错误时区运行的脚本应为GMT + 2

我尝试更改电子表格设置和项目属性。

select (case when seqnum <= 10 then id end) as id,
       max(case when seqnum <= 10 then location else 'All else' end) as location,
       max(case when seqnum <= 10 then datetime end) as datetime,
       sum(amount)
from (select t.*,
             row_number() over (order by amount desc) as seqnum
      from t
     ) t
group by (case when seqnum <= 10 then id end);

甚至尝试过:

    function onEdit(e) {
   var TIME_ZONE = "GMT+2"; 
  var date = Utilities.formatDate(new Date(),"Africa/Johannesburg", 'hh:mm:ss');

  //if column A has been edited, set date in same row in column B
  if (e.range.getColumn() == 1) {
    var row = e.range.getRow();
    e.source.getSheetByName('validated').getRange(row, 2).setValue(date);
  }
}

需要将时间戳记设置为“编辑”上的当前时间。

1 个答案:

答案 0 :(得分:0)

将格式更改为 Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile' with basic configurator --> [DEBUG] (s) groupId = com.different.jar [DEBUG] (s) artifactId = custom_mapstruct_config [DEBUG] (s) version = 19.6.0.0.999-SNAPSHOT [DEBUG] (s) groupId = org.mapstruct [DEBUG] (s) artifactId = mapstruct-processor [DEBUG] (s) version = 1.2.0.Final [DEBUG] (f) annotationProcessorPaths = [com.different.jar:custom_mapstruct_config:19.6.0.0.999-SNAPSHOT.jar, org.mapstruct:mapstruct-processor:1.2.0.Final.jar] [DEBUG] (f) basedir = C:\... [DEBUG] (f) buildDirectory = ...\target [DEBUG] (f) compilePath = ... [DEBUG] (f) compileSourceRoots = ... [DEBUG] (f) compilerArgs = [-Amapstruct.suppressGeneratorTimestamp=true, -Amapstruct.suppressGeneratorVersionInfoComment=true, -Amapstruct.unmappedTargetPolicy=WARN] [DEBUG] (f) compilerId = javac [DEBUG] (f) debug = true [DEBUG] (f) encoding = ISO-8859-15 [DEBUG] (f) failOnError = true [DEBUG] (f) failOnWarning = false [DEBUG] (f) forceJavacCompilerUse = false [DEBUG] (f) fork = false ,添加hh:mm:ss a将格式设置为所需的AM / PM范围。有关如何使用a方法正确格式化日期的更多详细信息,请参见Oracle上的SimpleDateFormatspecification。 如果仍然有问题,请参考我之前的评论。