Thread: system date != now()

system date != now()

From
CSN
Date:
How do I update pg's date? It doesn't appear to have
been updated with DST. I was under the impression that
changing the system's date/time (date -s "...") would
cause pg to use that.


[root@domain data]# date
Sun Apr 11 00:39:07 MDT 2004
[root@domain data]#
[root@domain data]# psql -U admin database1
Welcome to psql 7.4.1, the PostgreSQL interactive
terminal.

database1=> select now();
              now
-------------------------------
 2004-04-10 23:39:14.048634-07
(1 row)

database1=> select current_time;
       timetz
--------------------
 23:39:46.202589-07
(1 row)

database1=> select current_date;
    date
------------
 2004-04-10
(1 row)

database1=> select current_timestamp;
         timestamptz
------------------------------
 2004-04-10 23:40:10.53221-07
(1 row)

database1=>


__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

Re: system date != now()

From
CSN
Date:
timezone in postgresql.conf was set to MST. Setting it
to MDT gave this error:

LOG:  unrecognized time zone name: "MDT"
FATAL:  invalid value for parameter "timezone": "MDT"

http://www.postgresql.org/docs/7.4/interactive/datetime-keywords.html#DATETIME-TIMEZONE-TABLE
(MDT is listed there)

Anyhow, I commented out "timezone" and the time is
correct now.


--- CSN <cool_screen_name90001@yahoo.com> wrote:
> How do I update pg's date? It doesn't appear to have
> been updated with DST. I was under the impression
> that
> changing the system's date/time (date -s "...")
> would
> cause pg to use that.
>
>
> [root@domain data]# date
> Sun Apr 11 00:39:07 MDT 2004
> [root@domain data]#
> [root@domain data]# psql -U admin database1
> Welcome to psql 7.4.1, the PostgreSQL interactive
> terminal.
>
> database1=> select now();
>               now
> -------------------------------
>  2004-04-10 23:39:14.048634-07
> (1 row)
>
> database1=> select current_time;
>        timetz
> --------------------
>  23:39:46.202589-07
> (1 row)
>
> database1=> select current_date;
>     date
> ------------
>  2004-04-10
> (1 row)
>
> database1=> select current_timestamp;
>          timestamptz
> ------------------------------
>  2004-04-10 23:40:10.53221-07
> (1 row)
>
> database1=>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - File online by April 15th
> http://taxes.yahoo.com/filing.html
>


__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

Re: system date != now()

From
Bruno Wolff III
Date:
On Sun, Apr 11, 2004 at 00:01:42 -0700,
  CSN <cool_screen_name90001@yahoo.com> wrote:
>
> timezone in postgresql.conf was set to MST. Setting it
> to MDT gave this error:
>
> LOG:  unrecognized time zone name: "MDT"
> FATAL:  invalid value for parameter "timezone": "MDT"

I think setting the timezone to MST accounts for your problem.
If you want to switch timezones at the DST boundaries, I think
you want to use a timezone of "MST7MDT".