From: | tolik(at)icomm(dot)ru (Anatoly K(dot) Lasareff) |
---|---|
To: | hoelc(at)pd(dot)jaring(dot)my |
Cc: | pgsql-admin(at)hub(dot)org, pgsql-admin(at)postgreSQL(dot)org, pgsql-general(at)hub(dot)org |
Subject: | Re: [ADMIN] date & time |
Date: | 1999-03-07 09:56:05 |
Message-ID: | 87emn1fwsq.fsf@tolikus.hq.aaanet.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-interfaces |
>>>>> "h" == hoelc <hoelc(at)pd(dot)jaring(dot)my> writes:
h> Hello,
h> Can some one please tell me how to set the date&time in the PostgreSQL
h> system?
h> I try to use date('now') and time('now') to keep tract of the data and
h> time when the data is inserted or updated. When I use sql " insert into
h> table (data1, date_chg, time_chg) values ('abc',date('now'),time('now'))
h> " to insert the date and time data, the data successfully inserted but
h> when I retrive the data, it shows that the date and time is always "
h> 01-01-2000 " and " 08:00:00 " , now is of couse not year 2000 and the
h> time is also not 8 o'clock. Why? How should I correct this?
h> I am using PostgreSQL in Linux system, and the date & time for Linux
h> system are correct.
Yes, here is the problem:
tolik=> select date('now'), time('now');
date|time
----------+--------
01-01-2000|03:00:00
(1 row)
Here is the solution:
tolik=> select date('now'::datetime), time('now'::datetime);
date|time
----------+--------
03-07-1999|13:00:55
(1 row)
--
Anatoly K. Lasareff Email: tolik(at)icomm(dot)ru
Senior programmer
From | Date | Subject | |
---|---|---|---|
Next Message | Ralf Weidemann | 1999-03-07 11:59:58 | servlet problem |
Previous Message | Anton de Wet | 1999-03-07 09:04:03 | Indexes and subqueries |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1999-03-07 16:20:39 | Re: [INTERFACES] Counting updates with libpq |
Previous Message | James Thompson | 1999-03-06 20:03:03 | Re: [GENERAL] date & time |