在PostgreSQL中,如何从其他时区的日期时间中找到UTC日期时间

huangapple go评论62阅读模式
英文:

In PostgreSQL How To find UTC date time from other time zone date time

问题

I have IST date time, I need to find UTC time & date from IST date in PostgreSQL.

At '2023-01-06T16:35:21.628+11:00' this time what was the UTC time I need to find. this time is as per IST time zone.
I am new in PostgreSQL.

英文:

I have IST date time, I need to find UTC time & date from IST date in PostgreSQL.

At '2023-01-06T16:35:21.628+11:00' this time what was the UTC time I need to find. this time is as per IST time zone.
I am new in PostgreSQL.

答案1

得分: 1

UTC时间和日期由以下代码给出:

SELECT '2023-01-06T16:35:21.628+11:00' :: timestamp with time zone AT time zone 'utc'

UTC日期由以下代码给出:

SELECT ('2023-01-06T16:35:21.628+11:00' :: timestamp with time zone AT time zone 'utc') :: date

UTC时间由以下代码给出:

SELECT ('2023-01-06T16:35:21.628+11:00' :: timestamp with time zone AT time zone 'utc') :: time

查看dbfiddle

英文:

UTC time & date is given by :

SELECT '2023-01-06T16:35:21.628+11:00' :: timestamp with time zone AT time zone 'utc'

UTC date is given by :

SELECT ('2023-01-06T16:35:21.628+11:00' :: timestamp with time zone AT time zone 'utc') :: date

UTC time is givven by :

SELECT ('2023-01-06T16:35:21.628+11:00' :: timestamp with time zone AT time zone 'utc') :: time

see dbfiddle

huangapple
  • 本文由 发表于 2023年1月6日 14:02:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/75027476.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定