如何将unix_timestamp整数转换为可读文本中的时间。 如:
timestamp|integer|not null default 0
select timestamp from table limit 1;
1541001600
1541001600应转换为Thu Nov 1 00:00:00 CST 2018
PostgreSQL 8.0.2
你可以在postgresql中使用to_timestamp()
。
select to_timestamp(1541001600) AT TIME ZONE 'CST';
有关详细信息,请参阅Link
对于8.0:
SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 1541001600 * INTERVAL '1 second';
你应该真的升级你的Postgres!但我认为这会奏效:
select '1970-01-01'::timestamp + 1541001600 * interval '1 second'