Storing timestamps in text format

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Storing timestamps in text format
Date: 2010-11-26 18:28:52
Message-ID: fc18163a29b69fecf56d6fd2dfdceccd@smogura-softworks.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,

I perform following test:
1. Open connection (GMT+1)
2. Change timezone (GMT+3)
3. Write created timestamp.
4. Change timezone to different connection open and write (GMT+4)
5. Read timezone

During this I saw driver sends timestamp encoded with initial (in my case
+1), form connection open, time zone. It's because
TimestampUtils.toString(Calendar, Timestamp) uses defaultCal. Should it use
Calendar.getInstance() or new GregorianCalendar?

public synchronized String toString(Calendar cal, Timestamp x) {
if (cal == null)
cal = defaultCal; // = Calendar.getInstance() // new
GregorianCalendar()

--
----------
Radosław Smogura
http://www.softperience.eu

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Francesco Degrassi 2010-11-30 18:42:51 Postgresql XA prepare() method behaviour
Previous Message Radosław Smogura 2010-11-26 16:20:47 Re: Workarounds for getBinaryStream returning ByteArrayInputStream on bytea