반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- django
- Google Excel
- GIT
- Mac
- matplotlib
- string
- Apache
- hive
- Google Spreadsheet
- list
- numpy
- PySpark
- gas
- math
- PANDAS
- SQL
- 파이썬
- c#
- PostgreSQL
- Redshift
- dataframe
- array
- Github
- Kotlin
- Python
- google apps script
- Tkinter
- Java
- Excel
Archives
- Today
- Total
달나라 노트
Google Apps Script : getDay (요일, weekday) 본문
728x90
반응형
getDay() method는 특정 날짜의 요일을 요일 번호로 return해줍니다.
Syntax
Date.getDay()
사용법은 위와 같습니다.
Date 객체에 getDay() method를 적용하면 됩니다.
function myFunction() {
var today_dt = new Date();
var today_weekday = today_dt.getDay();
Logger.log(today_dt);
Logger.log(today_weekday);
}
- var today_dt = new Date();
new Date()로 현재 날짜와 시간을 얻어옵니다.
- var today_weekday = today_dt.getDay();
오늘 날짜/시간을 담고있는 today_dt 변수에 getDay() method를 적용하여 요일 정보를 얻어옵니다.
결과를 봅시다. 일단 지금 시점은 2022-11-21 02:44:04이고 Mon(월)인 것을 알 수 있습니다.
그리고 getDay()의 결과로는 1.0이 출력되었습니다.
1은 바로 월요일을 의미합니다.
아래 표는 getDay()로부터 return되는 요일 숫자와 요일 이름의 대응표입니다.
Weekday number | Weekday |
0 | Sunday |
1 | Monday |
2 | Tuesday |
3 | Wednesday |
4 | Thursday |
5 | Friday |
6 | Saturday |
728x90
반응형
'Google Apps Script' 카테고리의 다른 글
Comments