- 카테고리:
DATE_PART¶
날짜, 시간 또는 타임스탬프에서 지정된 날짜 또는 시간 부분을 추출합니다.
구문¶
인자¶
date_or_time_partThe unit of time. Must be one of the values listed in 지원되는 날짜 및 시간 부분 (for example,
month). The value can be a string literal or can be unquoted (for example,'month'ormonth).date_or_time_part이week(또는 그 변형)인 경우, 출력은 WEEK_START 세션 매개 변수에 의해 제어됩니다.date_or_time_part가dayofweek또는yearofweek(또는 그 변형)인 경우, 출력은 WEEK_OF_YEAR_POLICY 및 WEEK_START 세션 매개 변수에 의해 제어됩니다.
예를 포함한 자세한 내용은 달력상의 주 및 요일 을 참조하십시오.
date_interval_time_or_timestamp_exprA date, an interval, a time, or a timestamp, or an expression that can be evaluated to one of those data types.
반환¶
NUMBER 데이터 타입의 값을 반환합니다.
사용법 노트¶
When
date_interval_time_or_timestamp_expris a year-month interval value, the supporteddate_or_time_partvalues areyearandmonth.When
date_interval_time_or_timestamp_expris a day-time interval value, the supporteddate_or_time_partvalues areday,hour,minute,second, andnanosecond.Currently, when
date_interval_time_or_timestamp_expris a DATE value, the followingdate_or_time_partvalues aren’t supported:epoch_millisecondepoch_microsecondepoch_nanosecond
다른 날짜 및 시간 부분 (
epoch_second포함)이 지원됩니다.
팁
TIMESTAMP 값에서 단일 부분 대신 전체 DATE 또는 TIME 값을 추출하기 위해 TIMESTAMP 값을 DATE 또는 TIME 값으로 각각 캐스팅할 수 있습니다. 예:
예¶
이는 DATE 의 일부를 추출하는 간단한 예를 보여줍니다.
이는 TIMESTAMP 의 일부를 추출하는 예를 보여줍니다.
이는 TIMESTAMP를 Unix epoch (1970년 1월 1일 자정) 시작 이후 경과된 시간(초)으로 변환하는 예를 보여줍니다.
이는 TIMESTAMP를 Unix epoch (1970년 1월 1일 자정) 시작 이후 경과된 시간(밀리초)으로 변환하는 예를 보여줍니다.