I’m using postgresql 8.3 and i would like to know the timezone of a particular timestamp (a column in a table).
In the documentation i’ve found the keyword ‘timezone’
But i don’t understand how to apply it in a column of table. Is it possible ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume you have a column named
ctwhich has the typeTIMESTAMPTZin the tablet. Then you can use:to get the offset of the timezone in seconds. It that gives you
3600fromUTC/GMTthat means eitherGMT+1,CETor whatever. The value returned depends on yourTIMEZONEsetting.Sample (I live in Germany, actual timezone ist
GMT+1/CET):As you can see it always outputs anything in the configured timezone. So the offset you will get with
EXTRACT(TIMEZONE FROM ...)depends on yourTIMEZONEsetting. The timezone which was given onINSERTis lost, because it is not worth to be saved. The thing that counts is that everything is correct and that should not depend on theTIMEZONEsetting. PostgreSQL does that very well.