Created
December 13, 2018 16:01
-
-
Save jngbng/e9fdb66d245347b68f235e6c4e050fbb to your computer and use it in GitHub Desktop.
postgres 'at time zone' 동작
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set timezone='Asia/Seoul'; | |
show timezone; | |
SELECT '2018-12-01 00:00:00'::timestamp at time zone 'GMT'; | |
SELECT (timestamp '2018-12-01 00:00:00') at time zone 'GMT'; | |
-- 2018-12-01 09:00:00+09 | |
SELECT '2018-12-01 00:00:00' at time zone 'GMT'; | |
SELECT (date '2018-12-01') at time zone 'GMT'; | |
SELECT '2018-12-01 00:00:00'::timestamp with time zone at time zone 'GMT'; | |
SELECT timestamp with time zone '2018-12-01 00:00:00' at time zone 'GMT'; | |
-- 2018-11-30 15:00:00 | |
select now(); | |
-- 2018-12-01 00:00:00.000000+09 | |
select now() at time zone 'GMT'; | |
-- 2018-11-30 15:00:00.000000 | |
select now() at time zone 'GMT' at time zone 'GMT'; | |
-- 2018-12-01 00:00:00.000000+09 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment