설문조사
PostgreSQL/PPAS 관련 듣고 싶은 교육은


Powered by EnterpriseDB
총 게시물 66건, 최근 0 건
 

datestyle 패러미터

글쓴이 : PostgresDBA 날짜 : 2017-12-05 (화) 11:34 조회 : 33
SQL> SET datestyle='redwood, show_time';
SQL> show datestyle;
+--------------------+
|     DateStyle      |
+--------------------+
| Redwood, SHOW_TIME |
+--------------------+
 
SQL> select '01/02/1999'::timestamp, '1999-01-02'::timestamp, current_timestamp;
+--------------------+--------------------+----------------------------------+
|     timestamp      |     timestamp      |        current_timestamp         |
+--------------------+--------------------+----------------------------------+
| 01-FEB-99 00:00:00 | 02-JAN-99 00:00:00 | 05-DEC-17 11:31:07.530368 +09:00 |
+--------------------+--------------------+----------------------------------+
(1 row)


SQL> SET datestyle='iso,mdy';
SQL> show datestyle;
+-----------+
| DateStyle |
+-----------+
| ISO, MDY  |
+-----------+

SQL> select '01/02/1999'::timestamp, '1999-01-02'::timestamp, current_timestamp;
+---------------------+---------------------+-------------------------------+
|      timestamp      |      timestamp      |       current_timestamp       |
+---------------------+---------------------+-------------------------------+
| 1999-01-02 00:00:00 | 1999-01-02 00:00:00 | 2017-12-05 11:31:26.760432+09 |
+---------------------+---------------------+-------------------------------+
(1 row)


SQL> SET datestyle='iso, dmy';
SQL> show datestyle;
+-----------+
| DateStyle |
+-----------+
| ISO, DMY  |
+-----------+

SQL> select '01/02/1999'::timestamp, '1999-01-02'::timestamp, current_timestamp;
+---------------------+---------------------+-------------------------------+
|      timestamp      |      timestamp      |       current_timestamp       |
+---------------------+---------------------+-------------------------------+
| 1999-02-01 00:00:00 | 1999-01-02 00:00:00 | 2017-12-05 11:31:51.935354+09 |
+---------------------+---------------------+-------------------------------+
(1 row)




edb 의 datestyle 의 디폴트 세팅값은 Redwood, SHOW_TIME 입니다.

필자는 'ISO, MDY' 값으로 변경해서 운영합니다.


윤명식 2017-12-12 (화) 13:57
오라클의 NLS_DATE_FORMAT 같은 거군요
댓글주소
 

postgresdba.com