Skip to content

Instantly share code, notes, and snippets.

@jngbng
Created December 13, 2018 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jngbng/e9fdb66d245347b68f235e6c4e050fbb to your computer and use it in GitHub Desktop.
Save jngbng/e9fdb66d245347b68f235e6c4e050fbb to your computer and use it in GitHub Desktop.
postgres 'at time zone' 동작
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