반응형
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
- Java
- math
- PySpark
- gas
- Python
- matplotlib
- array
- Github
- PostgreSQL
- Google Excel
- 파이썬
- Google Spreadsheet
- numpy
- hive
- string
- SQL
- PANDAS
- GIT
- Tkinter
- Redshift
- google apps script
- django
- Excel
- Apache
- Kotlin
- list
- dataframe
- c#
- Presto
Archives
- Today
- Total
달나라 노트
Presto : last_day_of_month (특정 월의 마지막 날짜 구하기) 본문
728x90
반응형
Presto의 last_day_of_month는 특정 시점에 해당하는 월의 마지막 날짜를 return합니다.
Syntax
last_day_of_month(datetime)
주어진 datetime에 해당하는 월(month)의 마지막 날짜를 return합니다.
select current_timestamp as current_dttm --> 2025-10-18 02:40:06.3691
, last_day_of_month(current_timestamp) --> 2025-10-31
;
위 예시를 보면 현재 시점은 2025-10-18입니다.
last_day_of_month함수는 2025년 10월의 마지막 날인 2025-10-31을 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 : doy, day_of_year (년중 일수 추출) (0) | 2025.10.18 |
|---|---|
| Presto : dow, day_of_week (요일 추출, weekday) (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 |
| Presto : to_char (날짜를 문자로 변환, convert date to text) (0) | 2025.10.03 |
Comments
