在谷歌应用程序脚本中使用带有日期的 setValue() 的问题

问题描述

我在工作表中有一个选项卡,用于从日程安排应用程序收集日期。 Appointments!C:C 中的所有值都是日期。我正在尝试将这些日期带到另一个选项卡中,但有些值似乎正在转换为非日期,而有些则保留为日期。

我正在使用以下脚本:

  if(AppWO==OpenWO) 
      {
       var Appdate1 = new Date(AppRange[i][3]) // this gets the date value from sheet ss1
        var DateString1 = ("0" + Appdate1.getDate()).slice(-2) + "-" + ("0"+(Appdate1.getMonth()+1)).slice(-2) + "-" + Appdate1.getFullYear() //this breaks up and reforms the value
       ss0.getRange(j+2,24,1,1).setValue(DateString1)  //this puts the date in sheet ss0
      }

问题是表 ss0 上的“DateString1”似乎并不总是一个日期值。在处理日期时,我需要做一些不同的事情来使用 setValue() 吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)