あきぞらです。
今回は、GASで日付の値をフォーマットする方法を紹介していきます。
Utilities.formatDateを使う
Utilities.formatDate
を使うことで、
日付の値をフォーマットすることができます。
// 本日の日付を取得 let today = new date(); // 日本時間で「yyyy/MM/dd」にフォーマット today = Utilities.formatDate(today,”JST”, “yyyy/MM/dd”); // 2021/01/06が出力される consolog.(today)