Обсуждение: missing epoch timestamps literals in examples

Поиск
Список
Период
Сортировка

missing epoch timestamps literals in examples

От
PG Doc comments form
Дата:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/datatype-datetime.html
Description:

Thank you for lot of examples about date, time an timestamp.
I am missing how to work with unix (date)time(stamps) from epoch, e.g.
1592203289.310 for 2020-06-15T06:41:29.31.
How to directly insert unix ts literal into timezone column?
INSERT INTO table VALUES ('epoch'::timestamptz + 1592203289.310 * '1
second'::interval), (to_timestamp(1395036000) AT TIME ZONE 'UTC');
https://www.postgresonline.com/journal/archives/3-Converting-from-Unix-Timestamp-to-PostgreSQL-Timestamp-or-Date.html
https://stackoverflow.com/questions/34901804/how-work-with-unix-timestamp-on-postgresql

Re: missing epoch timestamps literals in examples

От
Tom Lane
Дата:
PG Doc comments form <noreply@postgresql.org> writes:
> I am missing how to work with unix (date)time(stamps) from epoch, e.g.
> 1592203289.310 for 2020-06-15T06:41:29.31.

regression=# select to_timestamp(1592203289.310);
       to_timestamp        
---------------------------
 2020-06-15 02:41:29.31-04
(1 row)

            regards, tom lane