Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDdPt-000656-Hv for pgsql-sql@arkaria.postgresql.org; Wed, 12 Feb 2014 17:16:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WDdPs-00038s-Oj for pgsql-sql@arkaria.postgresql.org; Wed, 12 Feb 2014 17:16:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDdPq-00038j-Nw for pgsql-sql@postgresql.org; Wed, 12 Feb 2014 17:16:06 +0000 Received: from mail-pb0-x22d.google.com ([2607:f8b0:400e:c01::22d]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDdPm-00054q-Ux for pgsql-sql@postgresql.org; Wed, 12 Feb 2014 17:16:06 +0000 Received: by mail-pb0-f45.google.com with SMTP id un15so9520760pbc.4 for ; Wed, 12 Feb 2014 09:16:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=1FHSopkUauPwd/8zqisdl2cdKtjSOtRRcPKVZdI5K/4=; b=et1XPPxY//UPPAV1ThsWqQBvXVpeay6fZMkyi0YP4jl8tx0GsESAwqTTm1QYrHfhTs irjLVH5QThbrGZUG0B22LVFXa0wuzBdUxLsAu9V4nVPS34hLg89yYHhJYggRjLbV2DQw OUgyK9zjt84DzNTSDRkK8TRFJUviDUYSDwginrtHJ6SDKzuO1FQ3FSdhqSNVUKBM/9tI xFM52P+FUNd1IdNKCWwO4qjWwzLkCVAxd+YDgOzPMvHd2dkVdayskbrGIEDMD2orV0Rv uKfmQfuJuZLay+ed3E11E4vGigDjG53EGn6Y22FS6ifcFnmuT3vi3sJdEMV3jprPCs3/ JZlA== X-Received: by 10.66.13.138 with SMTP id h10mr18483734pac.148.1392225360844; Wed, 12 Feb 2014 09:16:00 -0800 (PST) Received: from killi.site (173-160-167-74-Washington.hfc.comcastbusiness.net. [173.160.167.74]) by mx.google.com with ESMTPSA id hb10sm65423774pbd.1.2014.02.12.09.15.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Feb 2014 09:16:00 -0800 (PST) Message-ID: <52FBAC54.8080207@gmail.com> Date: Wed, 12 Feb 2014 09:16:04 -0800 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: rawi , pgsql-sql@postgresql.org Subject: Re: Re: Time AT TIME ZONE: false result using offset instead of time zone name References: <1392105285704-5791371.post@n5.nabble.com> <52FA3499.3020604@gmail.com> <1392193455856-5791556.post@n5.nabble.com> <52FB8D48.6010805@gmail.com> <1392218996355-5791602.post@n5.nabble.com> In-Reply-To: <1392218996355-5791602.post@n5.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 02/12/2014 07:29 AM, rawi wrote: > Adrian Klaver-3 wrote >> Welcome to the wacky world of time, it is all relative:) The choices are >> handle everything as UTC until you present to the end user or use actual >> timezones, for example, America/Los_Angeles. To illustrate, in your >> original post you said: >> >> "But it would be easier to ask a specific time offset (got from a client >> around the world), so for me +01 hour" >> >> Do you know if that offset supplied by the client was POSIX or ISO in >> its sign? > > The (playing) question was: how would I get the time zone of a browser > somewhere unknown on earth? > > And the found javascript solution would return the difference between GMT > and localtime in minutes, so for me west from Greenwich a negative integer. > > Please save the following in a html file eg. "time_offset.html" and load it > in your browser: I am on the US Pacific Coast so my current timezone is PST, UTC-8 ISO So using javascript in my browser: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset var offset = new Date().getTimezoneOffset(); offset = 480 480 minutes/60 minutes = 8 hours Which tracks with the above link: "The time-zone offset is the difference, in minutes, between UTC and local time. Note that this means that the offset is positive if the local timezone is behind UTC and negative if it is ahead." and also the POSIX offset. You just have to remember to invert sign for your local timezone when doing the AT TIMEZONE if you use the POSIX method. Of course you are counting on the client having their environment set up correctly. > > > > > -- Adrian Klaver adrian.klaver@gmail.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql