Skip to content

Instantly share code, notes, and snippets.

@tototoshi
Created July 19, 2014 14:14
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 tototoshi/61831d5be9275990e139 to your computer and use it in GitHub Desktop.
Save tototoshi/61831d5be9275990e139 to your computer and use it in GitHub Desktop.
timestamp with time zone
example=# CREATE TABLE tstest (ts1 timestamp, ts2 timestamp with time zone);
CREATE TABLE
example=# \d tstest;
Table "public.tstest"
Column | Type | Modifiers
--------+-----------------------------+-----------
ts1 | timestamp without time zone |
ts2 | timestamp with time zone |
example=# INSERT INTO tstest VALUES (current_timestamp, current_timestamp);
INSERT 0 1
example=# SELECT * FROM tstest;
ts1 | ts2
----------------------------+-------------------------------
2014-07-19 23:11:38.230859 | 2014-07-19 23:11:38.230859+09
(1 row)
example=# INSERT INTO tstest VALUES (current_timestamp, '2014-07-19 23:12:00+08');
INSERT 0 1
example=# SELECT * FROM tstest;
ts1 | ts2
----------------------------+-------------------------------
2014-07-19 23:11:38.230859 | 2014-07-19 23:11:38.230859+09
2014-07-19 23:13:29.347091 | 2014-07-20 00:12:00+09
(2 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment