Re: Timestamp without Timezone and differing client / server tzs
От | Ken Johanson |
---|---|
Тема | Re: Timestamp without Timezone and differing client / server tzs |
Дата | |
Msg-id | 48744BE0.1010304@kensystem.com обсуждение исходный текст |
Ответ на | Re: Timestamp without Timezone and differing client / server tzs (Oliver Jowett <oliver@opencloud.com>) |
Ответы |
Re: Timestamp without Timezone and differing client / server
tzs
Re: Timestamp without Timezone and differing client / server tzs |
Список | 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
В списке pgsql-jdbc по дате отправления: