반응형
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
- c#
- Java
- google apps script
- GIT
- list
- Google Spreadsheet
- SQL
- Apache
- Github
- Kotlin
- PANDAS
- gas
- Google Excel
- Tkinter
- Presto
- string
- PostgreSQL
- math
- 파이썬
- Python
- dataframe
- array
- django
- matplotlib
- hive
- Excel
- Redshift
- PySpark
- numpy
Archives
- Today
- Total
달나라 노트
Presto : doy, day_of_year (년중 일수 추출) 본문
728x90
반응형
doy, day_of_year함수는 주어진 특정 날짜가 속한 년도에서 주어진 날짜가 몇번째 날짜인지를 나타내줍니다.
단순히 해당 날짜의 일을 추출해주는 것과는 다릅니다.
Syntax
doy(datetime)
day_of_year(datetime)
주어진 datetime의 년중 일수를 추출합니다.
doy 함수와 dady_of_year 함수는 동일합니다.
select current_timestamp as current_dttm --> 2025-10-18 03:03:37.996
, doy(current_timestamp) as current_doy --> 291
, day_of_year(current_timestamp) as current_day_of_year --> 291
;
예시를 보면 현재 시점은 2025-10-18입니다.
2025년 10월 18일은 2025년 1년 전체에서 291번째 날짜이므로 291이 return됩니다.
만약 1월 1일의 날짜를 전달하면 doy, day_of_year 함수는 1을 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 : date_trunc (지정한 날짜 단위 기준으로 날짜 자르기) (0) | 2025.10.18 |
|---|---|
| Presto : hour, minute, second, millisecond (시간 성분 추출하기, 시간, 분, 초, 밀리초) (0) | 2025.10.18 |
| Presto : dow, day_of_week (요일 추출, weekday) (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 |
Comments