Converting TIMESTAMPTZs to DATEs in a specified time zone
#19511
Answered
by
soerenwolfers
Kodiologist
asked this question in
Q&A
Replies: 1 comment 5 replies
-
SELECT
x,
timezone('Etc/GMT+6', x) AS localtime,
localtime::DATE AS localdate,
FROM T
ORDER BY x
LIMIT 10; |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
Kodiologist
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Suppose I have this data:
How can I produce a new column of type
DATEwhere each value is the date of the correspondingxvalue in UTC-6 (i.e., what the Olson database callsEtc/GMT+6)? Thustimestamptz '2015-03-07T00:00:00Z'should becomedate '2015-03-06', andtimestamptz '2015-03-07T07:00:00Z'should be becomedate '2015-03-07'.Beta Was this translation helpful? Give feedback.
All reactions