Search Postgresql Archives

Re: Time Zone design issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/10/07 10:55, Scott Marlowe wrote:
> On 9/10/07, novnov <novnovice@xxxxxxxxx> wrote:
>> Your explanation of now() and localtime() is good...but localtime() to
>> postgres acting as a web app db, wouldn't it just return the local time as
>> far as the server is concerned?
> 
> No, it would return it as the local time of the POSTGRESQL client.
> 
> For instance, suppose that someone in NY, connects to a web app, which
> asks him what TZ he's in and he picks EST5EDT.  The web app sets
> timezone='EST5EDT' and inserts a time of '2007-07-11 12:30:00'.
> 
> The database now stores that as '2007-07-11 16:30:00+00'
> 
> No matter WHERE the postgresql server is, that's what it has in it.
> 
> Now, I connect from Chicago, and your web app ascertains my timezone
> as CST6CDT.  When I ask for the same timestamp, I get '2007-07-11
> 11:30:00-05'.
> 
> Now, if you don't set a timezone, then the database will use it's own.
>  If your postgresql server is in california, then it might have a
> timezone of PST8PDT set.  If your web app didn't tell it otherwise,
> then the time would be '2007-07-11 09:30:00-07'.
> 
> Note that there are IP lookup tools you can use to determine, or at
> least make a wild guess at, someone's timezone.  But you still need to
> let them pick one if you get it wrong.  Then you can store that
> timezone in a user profile and set it everytime the user uses your web
> app.

In both Windows *and* Unix "you" set your TZ when you install the
system.  There are system functions to inquire how you've set it.

Browsers already report back a mountain of client data to the web
server.  I'd be stunned if FF, IE, Opera, Konq, etc don't already
expose TZ, too.

- --
Ron Johnson, Jr.
Jefferson LA  USA

Give a man a fish, and he eats for a day.
Hit him with a fish, and he goes away for good!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG5W04S9HxQb37XmcRAhsrAKCr3WQZi0oyWSJsMxortjoExeaS1QCg5HbS
G+fd0X7UvX9406A+Td2GYpw=
=wk17
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux