Skip site navigation (1) Skip section navigation (2)

Re: LOCALTIMESTAMP has wrong time zone

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: JB(at)BlackSkyTech(dot)com
Cc: "'Kevin Grittner'" <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: LOCALTIMESTAMP has wrong time zone
Date: 2011-02-24 23:23:47
Message-ID: 1430.1298589827@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Jonathan Brinkman" <JB(at)BlackSkyTech(dot)com> writes:
> postgres(at)Cloud-DB1:~$ psql beta_cms_main -c "show timezone;"
>  TimeZone
> ----------
>  EST
> (1 row)

Hmmm ... you do realize that that setting will result in EST (GMT-5)
all year round?  It's more likely that you want America/New_York.
That's not your immediate problem, though it might be a problem come
daylight savings time.

> postgres(at)Cloud-DB1:~$ psql beta_cms_main -c "select now();"
>               now
> -------------------------------
>  2011-02-24 17:42:40.023498-05
> (1 row)

> postgres(at)Cloud-DB1:~$ psql beta_cms_main -c "select localtimestamp;"
>          timestamp
> ----------------------------
>  2011-02-24 17:42:40.078052
> (1 row)

> All looks correct to me!

Well, that shows that you're getting the correct answer for
localtimestamp in psql, so if your application is getting different
answers, then you need to look into what it is that your application
is doing differently.  Possibly you have some other value of timezone in
force in the application's sessions, or there's some conversion going
on in the client that you haven't told us about.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Greg StarkDate: 2011-02-25 02:03:40
Subject: Re: Function trunc() behaves in unexpected manner with different data types
Previous:From: Kevin GrittnerDate: 2011-02-24 22:58:47
Subject: Re: LOCALTIMESTAMP has wrong time zone

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group