PostgreSQL Get UNIX Timestamp

Source: Internet
Author: User

--Timestamp to UNIX timestamp

Select Now (), EXTRACT (epoch from TIMESTAMP with time ZONE ' Now "):: int as ext, EXTRACT (epoch from now ()):: int, Current_ti Mestamp,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 ';


This article is from the "Yiyi" blog, make sure to keep this source http://heyiyi.blog.51cto.com/205455/1872904

PostgreSQL Get UNIX Timestamp

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.