Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

PostgreSQL time and Unix timestamp

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1.unix timestamp-"time"

Second

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

? column?

-

2016-08-16 10 09R 16 16 8

(1 row)

# SELECT TIMESTAMP WITHOUT TIME ZONE 'epoch' + 1471313356 * INTERVAL' 1 second'

? column?

-

2016-08-16 02:09:16

(1 row)

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

? column?

-

2016-04-19 10 37RU 16.269V 08

(1 row)

Millisecond

# SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 1464186650352 * INTERVAL' 1 milliseconds'

? column?

-

2016-05-25 22-30-50-35-52-08

(1 row)

# SELECT TIMESTAMP WITHOUT TIME ZONE 'epoch' + 1464186650352 * INTERVAL' 1 milliseconds'

? column?

-

2016-05-25 14 140 30 50.352

(1 row)

#

two。 Time-"Unix timestamp"

Second

# SELECT EXTRACT (EPOCH FROM TIMESTAMP WITHOUT TIME ZONE '2016-05-25 1415 3015) 50.352')

Date_part

-

1464186650.352

(1 row)

# SELECT EXTRACT (EPOCH FROM TIMESTAMP WITH TIME ZONE '2016-05-25 1415 3015) 50.352')

Date_part

-

1464157850.352

(1 row)

Millisecond

# SELECT EXTRACT (EPOCH FROM TIMESTAMP WITHOUT TIME ZONE '2016-05-25 1414 30mer 50.352') * 1000

? column?

-

1464186650352

(1 row)

#

Postgres=# SELECT extract (epoch FROM '2017-02-07 11:18:23.098+08'::timestamp with time zone)

Date_part

-

1486437503.098

(1 row)

Postgres=# select to_timestamp (1486437503.098)

To_timestamp

-

2017-02-07 11 purl 18 purl 23.098 Vol 08

(1 row)

Postgres=#

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report