From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | Chris Bartlett <c(dot)bartlett(at)paradise(dot)net(dot)nz> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Server timestamp |
Date: | 2009-05-03 13:41:33 |
Message-ID: | dcc563d10905030641q4df253b2t957914b4a651533@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sun, May 3, 2009 at 7:04 AM, Chris Bartlett
<c(dot)bartlett(at)paradise(dot)net(dot)nz> wrote:
> Date and time functions like current_time return the client machine's time.
> Is there a way of getting the database server's time? I have a situation
> that requires comparison of a date stamp on records with "today", but I need
> to avoid the possibility of a user changing their computer's clock time.
I think you're confused. According to the docs:
CURRENT_TIME and CURRENT_TIMESTAMP deliver values with time zone;
LOCALTIME and LOCALTIMESTAMP deliver values without time zone.
The time delivered is the server's time, adjusted to client's
timezone. If you want the server time without timezone then use
localtime / localtimestamp.
It's never the client's time.
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2009-05-03 13:45:12 | Re: Server timestamp |
Previous Message | Chris Bartlett | 2009-05-03 13:04:36 | Server timestamp |