반응형
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
- google apps script
- Presto
- Kotlin
- Java
- Python
- Redshift
- Tkinter
- Google Spreadsheet
- django
- gas
- 파이썬
- Google Excel
- array
- PySpark
- PostgreSQL
- c#
- list
- Excel
- Github
- math
- PANDAS
- matplotlib
- string
- numpy
- Apache
- GIT
- hive
- dataframe
- SQL
Archives
- Today
- Total
달나라 노트
Presto : date_parse (문자를 날짜/시간으로 변환, convert text to date/time) 본문
SQL/Presto
Presto : date_parse (문자를 날짜/시간으로 변환, convert text to date/time)
CosmosProject 2025. 10. 3. 17:04728x90
반응형
date_parse 함수는 어떠한 형태로 적힌 날짜/시간 텍스트를 실제 date/time data로 변환을 해줍니다.
Syntax
date_part(text, format)
- text
date/time으로 변환할 대상 text입니다.
- format
text가 어떤 pattern으로 적혀있는지를 나타냅니다.
format의 패턴과 text가 일치해야 함수가 정상적으로 작동합니다.
| Keyword | Meaning |
| %Y | 4자리 년도 |
| %y | 2자리 년도 |
| %m | 2자리 월(01~12) |
| %c | 1자리 월(1~12) |
| %M | 월 이름(January~December) |
| %b | 월 이름(Jan~Dec) |
| %d | 2자리 일(01~31) |
| %e | 1자리 일(1~31) |
| %H | 24시 기준 시간(00~23) |
| %h %p | 12시 기준 시간(1~12) |
| %I %p | 12시 기준 시간(1~12) |
| %i | 2자리 분(00~59) |
| %s | 2자리 초(00~59) |
select date_parse('20251225', '%Y%m%d') --> 2025-12-25 00:00:00
, date_parse('2025-12-25', '%Y-%m-%d') --> 2025-12-25 00:00:00
, date_parse('2025-12-25 14:23:28', '%Y-%m-%d %H:%i:%s') --> 2025-12-25:14:23:28
;
728x90
반응형
'SQL > Presto' 카테고리의 다른 글
| 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 : to_char (날짜를 문자로 변환, convert date to text) (0) | 2025.10.03 |
| Presto : substring, substr (문자열 추출하기, 문자열 자르기) (0) | 2025.10.03 |
| Presto : date_add() (시간 더하기, 날짜 더하기, 특정 기간 더하기) (0) | 2023.10.11 |
Comments
