Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!not-for-mail From: "M. Strobel" Newsgroups: comp.databases.postgresql Subject: Re: timestamp and time zone Date: Sat, 30 Apr 2011 17:58:37 +0200 Lines: 41 Message-ID: <922ptdFcr5U1@mid.uni-berlin.de> References: <91th8nFmufU1@mid.uni-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de sIX+x7ztobpZJPa0U3KQDAMfDaDhRXLLBmYrRYyKc21aCwNNc= User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.databases.postgresql:104 Am 30.04.2011 13:15, schrieb Jasen Betts: > On 2011-04-28, M. Strobel wrote: >> Hi, >> >> I did not quite understand the use case of timestamp with time zone. >> >> When do you need 'with time zone'? > > it's best to use it when you are dealing with real events that happen > at a specific instant > >> My tests show you can >> calculate other time zones time easily from a timestamp without >> time zone. > >> Is timestamp internally stored normalized to utc, and calculated >> to client time zone? Or to server time zone? > > timestamp with timezone is internally stored as a UTC timestamp > no zone information is stored. So '2011-04-30 23:02:39.296282+12' > is actually stored as '2011-04-30 11:02:39.296282 UTC'. (I know > it says "with timezone" on the label - postgresql fakes it ) > (actually it's stored as a number, not as a string) > > When it's retreived it will be translated to the best guess zone > apropriate for the user (using the server operating system's timezone > database) > > timestamp is internally stored with no zone translation so > '2011-04-30 23:02:39.296282' will look the same whatever > the user uses for their timezone. (different datestyle > settings can effect the date part however) > I see. So there is no automatic translation 'without time zone', but if you ask the system to translate it to another time zone it does so assuming local time. Thanks, I thought it was too much work to set up tests within different time zones... /Str.