0

我看到了这段代码:

var DAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',
            'Saturday', 'Sunday'];

  var pastQuery = 'SELECT ' + fields +
      ' FROM ACCOUNT_PERFORMANCE_REPORT WHERE DayOfWeek=' +
      DAYS[getDateStringInTimeZone('u', new Date())].toUpperCase() +
      ' DURING ' + dateRangeToStart + ',' + dateRangeToEnd;

如何getDateStringInTimeZone('u', new Date())返回DAYS数组的索引?

function getDateStringInTimeZone(format, date, timeZone) {
  date = date || new Date();
  timeZone = timeZone || AdsApp.currentAccount().getTimeZone();
  return Utilities.formatDate(date, timeZone, format);
}

我以为Utilities.formatDate(date, timeZone, format)返回一个字符串。

4

0 回答 0