Get the App
SLTechnology News&Howtos  ›  Servers  › 

Postgresql gets Unix timestamp

Shulou Source: shulou.com Published: 2022-06-03 04:56:45 09月21日 Update

-- timestamp to unix timestamp

Select now (), EXTRACT (EPOCH FROM TIMESTAMP WITH TIME ZONE 'now ()):: int as ext, extract (epoch FROM now ()):: int, CURRENT_TIMESTAMP,date_part (' epoch',CURRENT_TIMESTAMP):: int

-- unix timestamp to timestamp

SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 982384720.12 * INTERVAL' 1 second'

-- SELECT TIMESTAMP WITH TIME ZONE 'epoch' + extract (epoch FROM now ()) * INTERVAL' 1 second'

Tags: time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Apple Microsoft Shulou Tech Info Linux