반응형
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
- Apache
- Excel
- list
- Github
- Redshift
- Python
- Tkinter
- PostgreSQL
- Google Spreadsheet
- Google Excel
- PySpark
- google apps script
- matplotlib
- string
- django
- Presto
- c#
- PANDAS
- array
- numpy
- dataframe
- SQL
- gas
- Java
- hive
- Kotlin
- math
Archives
- Today
- Total
달나라 노트
Presto : hour, minute, second, millisecond (시간 성분 추출하기, 시간, 분, 초, 밀리초) 본문
SQL/Presto
Presto : hour, minute, second, millisecond (시간 성분 추출하기, 시간, 분, 초, 밀리초)
CosmosProject 2025. 10. 18. 12:12728x90
반응형
Presto에서 사용할 수 있는 시간 성분을 추출하는 함수를 알아봅시다.
| Function name | Description |
| hour(datetime) | 주어진 datetime의 시간(hour)성분을 추출합니다. |
| minute(datetime) | 주어진 datetime의 분(minute)성분을 추출합니다. |
| second(datetime) | 주어진 datetime의 초(second)성분을 추출합니다. |
| millisecond(datetime) | 주어진 datetime의 밀리초(millisecond)성분을 추출합니다. |
select current_timestamp as current_dttm --> 2025-10-18 03:13:54.561
, hour(current_timestamp) as current_hour --> 3
, minute(current_timestamp) as current_minute --> 13
, second(current_timestamp) as current_second --> 54
, millisecond(current_timestamp) as current_millisecond --> 561
;
현재 시점은 2025-10-18 03:13:54.561 입니다.
여기서 각각의 함수의 결과를 보면 시/분/초/밀리초를 제대로 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 : doy, day_of_year (년중 일수 추출) (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
