formatDate(date, timeZone, format)
function isHoliday() {
var week = Utilities.formatDate(new Date(), 'Asia/Tokyo', 'u');
if (week == 7) {
return true;
}
}
formatDateメソッドの見方
Class SimpleDateFormat
- u
- Day number of week (1 = Monday, ..., 7 = Sunday)
- 月[1]
- 火[2]
- 水[3]
- 木[4]
- 金[5]
- 土[6]
- 日[7]
week == 7
であればweekは日曜日をさすため、isHoliday関数はtrue