Re: Retrieve the server's time zone

From: rob stone <floriparob(at)gmail(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Retrieve the server's time zone
Date: 2017-11-21 16:51:03
Message-ID: 1511283063.7643.3.camel@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, 2017-11-21 at 13:44 +0100, Thomas Kellerer wrote:
> Vladimir Sitnikov schrieb am 21.11.2017 um 12:52:
> > Could you please clarify what is the case of "receiving server-side
> > time zone"?
> >
> > For instance: do you need PostgreSQL time zone or OS time zone?
>
> I need a timestamp in the server's time zone. Or at leas the time
> zone of
> the OS. The one that is configured for Postgres on the server would
> do as
> well (in my case that is the server's OS time zone)
>
> E.g.
>
> select localtimestamp
>
> will return the server's local time converted to the *client's* time
> zone in JDBC.
>
> In psql however, it does return the timestamp as "seen" by the
> server.
>
> I could live with getting the server's OS time zone through "show
> timezone"
> because then I could convert current_timestamp back to that time
> zone.
>
> Thomas
>
>
>
>
>
Hi Thomas,

What does java.util.TimeZone.getDefault() return on your server?

As in:- TimeZone timeZone = TimeZone.getDefault();
timeZone.getDisplayName();
timeZone.getID();
timeZone.getOffset( System.currentTimeMillis() );

HTH.
Rob

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Michael Paquier 2017-11-21 23:00:16 Re: [pgjdbc/pgjdbc] befea1: Add SCRAM-SHA-256 support (#842)
Previous Message David G. Johnston 2017-11-21 14:57:49 Re: Retrieve the server's time zone