-
PostgreSQL 시간 조회Database/PostgreSQL 2019.01.29 01:36
현재 시간 조회
현재 타임존 조회postgres=# select now();
타임존 변경 방법postgres=# show timezone;
시스템 일자postgres=# SET TIME ZONE 'Asia/Seoul';
년도 추출postgres=# select current_date, current_time, timeofday();
postgres=# select now(), current_timestamp, timestamp 'now';
월 추출postgres=# select date_part('year', current_timestamp);
일 추출postgres=# select date_part('month', current_timestamp);
분 추출postgres=# select date_part('day', current_timestamp);
초 추출postgres=# select date_part('minute', current_timestamp);
요일/일차 추출postgres=# select date_part('second', current_timestamp);
postgres=# select extract('dow' from timestamp '2013-07-30 20:38:40'); -- 일요일(0), 토요일(6)
result: 5postgres=# select extract('isodow' from timestamp '2013-07-30 20:38:40'); -- 월요일(1), 일요일(7)
result: 5postgres=# select extract('doy' from timestamp '2013-07-30 20:38:40');
'Database > PostgreSQL' 카테고리의 다른 글
Docker를 이용해 PostgreSQL 설치 (0) 2019.02.07 PostgreSQL 시간 조회 (0) 2019.01.29 PostgreSQL 주기적인 유지관리 Vacuuming (0) 2019.01.28 PostgreSQL 테이블스페이스 및 오브젝트 사용량 확인 (0) 2019.01.01 PostgreSQL 백업 및 복원 (0) 2019.01.01 PostgreSQL 로컬라이제이션 (0) 2019.01.01 TAG
댓글 0