반응형
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 | 31 |
Tags
- GIT
- google apps script
- list
- c#
- numpy
- SQL
- Excel
- Kotlin
- PostgreSQL
- PySpark
- 파이썬
- Google Excel
- django
- dataframe
- hive
- Tkinter
- PANDAS
- Google Spreadsheet
- Github
- string
- matplotlib
- math
- Python
- Redshift
- array
- gas
- Apache
- Presto
- Java
Archives
- Today
- Total
달나라 노트
Presto : dow, day_of_week (요일 추출, weekday) 본문
728x90
반응형
dow, day_of_week는 주어진 datetime이 무슨 요일인지를 요일 번호로 추출해줍니다.
Syntax
dow(datetime)
day_of_week(datetime)
주어진 datetime의 요일을 번호로 추출해줍니다.
dow와 day_of_week함수는 동일합니다.
아래 표는 각 요일에 해당하는 숫자입니다.
| day of week | day of week number |
| Mon | 1 |
| Tue | 2 |
| Wed | 3 |
| Thu | 4 |
| Fri | 5 |
| Sat | 6 |
| Sun | 7 |
select current_timestamp as current_dttm --> 2025-10-18 02:40:06.391
, dow(current_timestamp) as current_dow --> 6
, day_of_week(current_timestamp) as current_day_of_week --> 6
;
current_timestamp는 2025-10-18입니다.
2025년 10월 18일은 토요일이므로 토요일에 해당하는 6이라는 숫자가 return됩니다.
FYI
https://prestodb.io/docs/current/functions/datetime.html#dow-x-bigint
Date and Time Functions and Operators - Presto 0.295 Documentation
Date and Time Functions and Operators Date and Time Operators Operator Example Result + date '2012-08-08' + interval '2' day 2012-08-10 + time '01:00' + interval '3' hour 04:00:00.000 + timestamp '2012-08-08 01:00' + interval '29' hour 2012-08-09 06:00:00.
prestodb.io
728x90
반응형
'SQL > Presto' 카테고리의 다른 글
| Presto : hour, minute, second, millisecond (시간 성분 추출하기, 시간, 분, 초, 밀리초) (0) | 2025.10.18 |
|---|---|
| Presto : doy, day_of_year (년중 일수 추출) (0) | 2025.10.18 |
| Presto : last_day_of_month (특정 월의 마지막 날짜 구하기) (0) | 2025.10.18 |
| Presto : year, quarter, month, week, week_of_year, day, day_of_month (날짜 성분 추출하기, 년도, 분기, 월, 주, 일) (0) | 2025.10.18 |
| Presto : date_parse (문자를 날짜/시간으로 변환, convert text to date/time) (0) | 2025.10.03 |
Comments
