Home
The Toolkit for Online Communities
17598 Community Members, 0 members online, 5117 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Q&A : postgresql current_timestamp

Forum OpenACS Q&A: postgresql current_timestamp

Icon of envelope Request notifications

Collapse
Posted by Gilbert Wong on
I ran this command in the psql interpreter:

select current_timestamp;

and I compared it to the system's date function.  PostgreSQL's time
is about 3 hours ahead of the system time!  How can I synchronize the
times?  Thanks!

Collapse
Posted by Don Baccus on
Ummm...I've never seen that.  What does the "-nn" value appended to the timestamp say, is it the same as for your timezone?  Is it off by three, perhaps?
Collapse
Posted by Gilbert Wong on
It is -04.  I'm in the pacific time zone.  what does the -04 mean?  Thanks.
Collapse
Posted by Simon Carstensen on
It means that you're 4 hours behind UTC.
Collapse
Posted by Gilbert Wong on
Thanks.  That's not the right time zone for me.  I'm in the Pacific Time zone and should be GMT-8.  How can I change this in PostgreSQL?  My system time is correct.
Collapse
Posted by Simon Carstensen on
PGTZ sets the default time zone.

Add this to your postgres user's .bash_rc file:

"export PGTZ=DEFAULT"

DEFAULT sets the time zone to your local time zone (the one that your operating system defaults to).

Collapse
Posted by Gilbert Wong on
Simon,

That doesn't work.  It still registers the timezone as -04.  HPUX is a bitch to work with.  Aghhhh! :)

Collapse
Posted by Simon Carstensen on
Oh, though you were using Linux..

Anyway, are you sure PGTZ or TZ are set correctly (I don't know if my Linux syntax will work on your machine - have you changed it so it'll work on HP-UX?)?

Collapse
Posted by Gilbert Wong on
I think I set the environment variables correctly, but these might not be the correct environment variables for HPUX.  hmmm...  I really wish we could use linux boxes.  :)
Collapse
Posted by Simon Carstensen on
Sorry, I don't know anything about Postgres on HP-UX. You should read the "PostgreSQL 7.1 Administrator's Guide" though.
Collapse
Posted by Simon Carstensen on
Also...

Search for "time zone".

And ask your question on the postgres mailing-list and remember to report back if you find the answer.