Re: postgres time zone settings(time difference in Server and client)

From: Richard Huxton <dev(at)archonet(dot)com>
To: Anoop G <anoopmadavoor(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: postgres time zone settings(time difference in Server and client)
Date: 2008-07-25 09:23:22
Message-ID: 48899B8A.7060404@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Anoop G wrote:
> Hai all,
>
> I have database running on server. I am using python to run my
> application.postgres client is running on the clients .All clients are
> connected to a single database running on server. Each time application
> starts ,the login time is taken from server using the query
> """select CAST ( timeofday() AS timestamp"""
>
> But the problem the time which I got is different from that of server
> machine . I Think the postgres client is adding some values to the server
> time. How can I solve this .Is there any configuration setting for client to
> solve this?.In which location client's configuration file is stored( I am
> using Linux(Debian )?.

1. If you have a recent version of PostgreSQL use clock_timestamp()
2. Why are you using timestamp without timezone?

SELECT clock_timestamp();
clock_timestamp
--------------------------------
25/07/2008 10:21:58.464055 BST

SET timezone='EST';

SELECT clock_timestamp();
clock_timestamp
--------------------------------
25/07/2008 04:22:19.584367 EST

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pawel Socha 2008-07-25 09:24:22 Re: postgres time zone settings(time difference in Server and client)
Previous Message Anoop G 2008-07-25 09:12:21 Re: postgres time zone settings(time difference in Server and client)