Re: How do we get the Client-Time and Server-Time from psql ?

From: raghavendra t <raagavendra(dot)rao(at)gmail(dot)com>
To: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How do we get the Client-Time and Server-Time from psql ?
Date: 2010-06-02 22:29:20
Message-ID: AANLkTikDCzJZ6fn5DHuPQBnpbaKtvx3JOAk471c7zPxH@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

Thank you for the update.

Suppose am at the server-end, how could i get the client-time. Its really
troublesome when compared with the timezone column in a table.

Regards
Raghavendra

On Wed, Jun 2, 2010 at 11:37 PM, Steve Crawford <
scrawford(at)pinpointresearch(dot)com> wrote:

> On 06/02/2010 02:48 AM, raghavendra t wrote:
>
>> Hi All,
>>
>> How do i get the client time and server time. I am connecting remotely. If
>> i give SELECT CURRENT_TIME;,it shows the server time. How do we get the
>> client time ?
>>
>> Time is the same everywhere but displayed in different ways according to
> local time-zones. In order to deal with non-synchronized clients or
> server-side specific values like differentiating between CURRENT_TIME which
> returns the time at start of transaction throughout the life of the
> transaction and timeofday() which _does_ change throughout a transaction you
> should use "SET TIMEZONE". For example my server is on the West Coast but I
> can display time for East Coasters:
>
>
> steve=# show timezone;
> TimeZone
> -----------
> localtime
>
> steve=# select current_time;
> timetz
> --------------------
> 11:06:14.745969-07
>
> steve=# set timezone to 'est5edt';
> SET
> steve=# show timezone;
> TimeZone
> ----------
> EST5EDT
>
> steve=# select current_time;
> timetz
> --------------------
> 14:06:29.456009-04
>
> Cheers,
> Steve
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Browne 2010-06-02 22:29:53 Re: Commit every N rows in PL/pgsql
Previous Message Chris Browne 2010-06-02 22:26:45 Re: Commit every N rows in PL/pgsql