0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Google Apps Script (gas) で日付のタイムゾーンを日本に直す方法

0
Posted at

Google Apps Script (gas) で日付のタイムゾーンを日本に直す方法

function myFunction() {
  const date = new Date();
  const strdate = date.getFullYear() + '/' + (date.getMonth()+1) + '/' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
  Logger.log(date);
  Logger.log(strdate);
}

解決方法

タイムゾーンを変更
プロジェクト設定 → 日本標準時間に変更

image.png

appsscript.jsonを開きて、見るとtimeZomeが America/New_York からAsia/Tokyoに変更されているのが分かります。
image.png

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?