Skip site navigation (1) Skip section navigation (2)

Re: Timestamp without Timezone and differing client / server tzs

From: Ken Johanson <pg-user(at)kensystem(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Timestamp without Timezone and differing client / server tzs
Date: 2008-07-09 05:25:52
Message-ID: 48744BE0.1010304@kensystem.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Oliver Jowett wrote:
>>> Ken Johanson wrote:
>> This is useful where plural databases (not under my control) may exist 
>> each in different timezones, and the app must deal with each 
>> concurrently; where storing server configs (separate from the URL) and 
>> passing Calendar objects for each, could be avoided.
> 
> But if you are using timestamp-without-timezone in each database, I 
> don't understand why the server timezone comes into the equation at all? 

The servers and their schema (use-of ts w/o tz are not under my control; 
adding with-timezone would likely break apps that transmit date values 
with offset already normalized).

> 
> Can you give me some concrete examples of schema + app code and how you 
> would want it to behave?
> 

Just to pass-in a timestamp, and which ever database it is sent to, be 
stored with its real atomic (integer) value (ie string conversion 
normalized to what db uses).

Simplified:

Timestamp NOW = new Timestamp(System.currentTimeMillis());
for (int i=0; i<SERVERS.length; i++)
{
Connection con = ....//SERVERS[i] etc; each server exists in different 
timezone, and datetime/timestamps cols do not store zone.
PreparedStatement ps = con.prepareStatement("INSERT INTO tbl 
(lastModified) VALUES (?)");
ps.setTimestamp(1, NOW));
ps.executeUpdate();
}

k



In response to

Responses

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2008-07-09 05:55:56
Subject: Re: Timestamp without Timezone and differing client / server tzs
Previous:From: Oliver JowettDate: 2008-07-09 04:52:23
Subject: Re: Timestamp without Timezone and differing client / server tzs

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group