SYS_EXTRACT_UTC in Postgresql
SYS_EXTRACT_UTC is used to convert time stamp to UTC time stamp. In postgres we can implement the same using below.
postgres=# select now() AT TIME ZONE ‘UTC’;
timezone
—————————-
2016-07-05 10:00:02.395834
(1 row)
We can set the same as a default value to a column in a table like below.
create table test_err
(
i int,
tim timestamp default (now() AT TIME ZONE ‘UTC’));
postgres=# insert into test_err(i) values(1);
INSERT 0 1
postgres=# select * from test_Err;
i | tim
—+—————————-
1 | 2016-07-05 09:25:02.859902
(1 row)