pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feeddate & time
4+ messages / 4 participants
[nested] [flat]
* date & time
@ 1999-03-06 17:20 hoelc <hoelc@pd.jaring.my>
1999-03-06 17:25 ` Re: [GENERAL] date & time Kevin Heflin <kheflin@shreve.net>
1999-03-06 20:03 ` Re: [GENERAL] date & time James Thompson <jamest@math.ksu.edu>
1999-03-07 09:56 ` Re: [ADMIN] date & time Anatoly K. Lasareff <tolik@icomm.ru>
0 siblings, 3 replies; 4+ messages in thread
From: hoelc @ 1999-03-06 17:20 UTC (permalink / raw)
To: pgsql-admin@hub.org; pgsql-admin@postgreSQL.org; pgsql-general@hub.org
Hello,
Can some one please tell me how to set the date&time in the PostgreSQL
system?
I try to use date('now') and time('now') to keep tract of the data and
time when the data is inserted or updated. When I use sql " insert into
table (data1, date_chg, time_chg) values ('abc',date('now'),time('now'))
" to insert the date and time data, the data successfully inserted but
when I retrive the data, it shows that the date and time is always "
01-01-2000 " and " 08:00:00 " , now is of couse not year 2000 and the
time is also not 8 o'clock. Why? How should I correct this?
I am using PostgreSQL in Linux system, and the date & time for Linux
system are correct.
One more question, what is the common data type for storing address?
Thank you very much.
Regards .... lch
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [GENERAL] date & time
1999-03-06 17:20 date & time hoelc <hoelc@pd.jaring.my>
@ 1999-03-06 17:25 ` Kevin Heflin <kheflin@shreve.net>
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Heflin @ 1999-03-06 17:25 UTC (permalink / raw)
To: hoelc <hoelc@pd.jaring.my>; +Cc: pgsql-admin@hub.org; pgsql-admin@postgreSQL.org; pgsql-general@hub.org
On Sun, 7 Mar 1999, hoelc wrote:
> Hello,
> Can some one please tell me how to set the date&time in the PostgreSQL
> system?
> I try to use date('now') and time('now') to keep tract of the data and
> time when the data is inserted or updated. When I use sql " insert into
> table (data1, date_chg, time_chg) values ('abc',date('now'),time('now'))
> " to insert the date and time data, the data successfully inserted but
> when I retrive the data, it shows that the date and time is always "
> 01-01-2000 " and " 08:00:00 " , now is of couse not year 2000 and the
> time is also not 8 o'clock. Why? How should I correct this?
> I am using PostgreSQL in Linux system, and the date & time for Linux
> system are correct.
I'm not real sure, but I would try CURRENT_DATE or CURRENT_DATETIME ?
Kevin
--------------------------------------------------------------------
Kevin Heflin | ShreveNet, Inc. | Ph:318.222.2638 x103
VP/Mac Tech | 333 Texas St #619 | FAX:318.221.6612
kheflin@shreve.net | Shreveport, LA 71101 | http://www.shreve.net
--------------------------------------------------------------------
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [GENERAL] date & time
1999-03-06 17:20 date & time hoelc <hoelc@pd.jaring.my>
@ 1999-03-06 20:03 ` James Thompson <jamest@math.ksu.edu>
2 siblings, 0 replies; 4+ messages in thread
From: James Thompson @ 1999-03-06 20:03 UTC (permalink / raw)
To: hoelc <hoelc@pd.jaring.my>; +Cc: pgsql-admin@hub.org; pgsql-admin@postgreSQL.org; pgsql-general@hub.org
On Sun, 7 Mar 1999, hoelc wrote:
> Hello,
> Can some one please tell me how to set the date&time in the PostgreSQL
> system?
> I try to use date('now') and time('now') to keep tract of the data and
> time when the data is inserted or updated. When I use sql " insert into
> table (data1, date_chg, time_chg) values ('abc',date('now'),time('now'))
> " to insert the date and time data, the data successfully inserted but
> when I retrive the data, it shows that the date and time is always "
> 01-01-2000 " and " 08:00:00 " , now is of couse not year 2000 and the
> time is also not 8 o'clock. Why? How should I correct this?
> I am using PostgreSQL in Linux system, and the date & time for Linux
> system are correct.
>
I use date(now()) and it seems to work ok for me. Until I added the ()
after now it was always some fixed date just like you have. Never tried
it with time.
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
James Thompson 138 Cardwell Hall Manhattan, Ks 66506 785-532-0561
Kansas State University Department of Mathematics
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [ADMIN] date & time
1999-03-06 17:20 date & time hoelc <hoelc@pd.jaring.my>
@ 1999-03-07 09:56 ` Anatoly K. Lasareff <tolik@icomm.ru>
2 siblings, 0 replies; 4+ messages in thread
From: tolik@icomm.ru @ 1999-03-07 09:56 UTC (permalink / raw)
To: hoelc@pd.jaring.my; +Cc: pgsql-admin@hub.org; pgsql-admin@postgreSQL.org; pgsql-general@hub.org
>>>>> "h" == hoelc <hoelc@pd.jaring.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@icomm.ru
Senior programmer
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~1999-03-07 09:56 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-03-06 17:20 date & time hoelc <hoelc@pd.jaring.my>
1999-03-06 17:25 ` Kevin Heflin <kheflin@shreve.net>
1999-03-06 20:03 ` James Thompson <jamest@math.ksu.edu>
1999-03-07 09:56 ` Anatoly K. Lasareff <tolik@icomm.ru>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox