---
title: "DATEPART"
description: "DATEPART SQL \uD568\uC218\uB294 datetime\uC5D0\uC11C \uC9C0\uC815\uD55C \uB0A0\uC9DC \uBD80\uBD84\uC744 \uAC00\uC838\uC635\uB2C8\uB2E4."
language: ko
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/ko/docs/invantive-universalsql/grammar/sql-functions/datepart
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/datepart
updated: 2026-12-04T13:31:18Z
license: https://documentation.invantive.eu/ko/
---

## 구문
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> DATEPART[DATEPART]:::quoted
    DATEPART --> End((END))
```

## 목적
`DATEPART` SQL 함수는 `datetime`에서 지정한 날짜 부분을 가져옵니다.

매개변수:
- Date part (`varchar2`): the part to be extracted, chosen from `year`, `yyyy`, `yy`, `quarter`, `qq`, `q`, `month`, `mm`, `m`,  `day`, `dy`, `y`, `week`, `ww`, `wk`, `hour`, `hh`, `minute`, `mi`, `n`, `second`, `ss`, `s`, `millisecond`, `ms`, `microsecond`, `mcs`, `nanosecond` and `ns`.
- date (`datetime`): 부분을 가져올 값.

반환값: 선택한 날짜/시간 부분의 값(`int32` 형식). 존재하지 않는 날짜 부분을 선택하면 `null`가 반환됩니다.

## 예시
다음 예제는 날짜의 월 부분을 가져옵니다:
```sql
select datepart('month', to_date('2016-12-31', 'YYYY-MM-DD'))

-------------------
12
```
다음 예제는 날짜의 주 부분을 가져옵니다:
```sql
select datepart('week', to_date('2016-12-31', 'YYYY-MM-DD'))

-------------------
52
```

