Re: Re: Time AT TIME ZONE: false result using offset instead of time zone name
От | Adrian Klaver |
---|---|
Тема | Re: Re: Time AT TIME ZONE: false result using offset instead of time zone name |
Дата | |
Msg-id | 52FBAC54.8080207@gmail.com обсуждение исходный текст |
Ответ на | Re: Time AT TIME ZONE: false result using offset instead of time zone name (rawi <only4com@web.de>) |
Список | pgsql-sql |
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
В списке pgsql-sql по дате отправления: