Tôi muốn chọn ngày (string có thể đọc được) theo thời kỷ nguyên từ một cột có thời gian trong mili giây long
trong postgres nhưChuyển đổi từ thời gian dài Postgres
select *, to_date(time in milli sec) from mytable
làm thế nào để làm gì?
Tôi muốn chọn ngày (string có thể đọc được) theo thời kỷ nguyên từ một cột có thời gian trong mili giây long
trong postgres nhưChuyển đổi từ thời gian dài Postgres
select *, to_date(time in milli sec) from mytable
làm thế nào để làm gì?
sử dụng
select *, to_timestamp(time in milli sec/1000) from mytable
Để tham khảo thấy postgres tài liệu tại http://www.postgresql.org/docs/9.0/static/functions-formatting.html
SELECT timestamp 'epoch' + time_in_millisec * interval '1 ms'
FROM mytable;
Xem manual here.
Đối mili giây
SELECT timestamp 'epoch' + proyecto.fecha_inicio * interval '1 ms'
from proyecto.proyecto
where proyecto.fecha_inicio is not null
Đối với giây
SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 982384720 * INTERVAL '1 second';
Trong sách hướng dẫn: http://www.postgresql.org/docs/current/interactive/functions-datetime.html.
Dòng: .. "Đây là cách bạn có thể chuyển đổi giá trị epoch về dấu thời gian" ..