datetime arithmatic

Started by Stuartalmost 25 years ago2 messagesgeneral
Jump to latest
#1Stuart
sfbarbee@yahoo.com

Folks,

I am new to postgresql 7.1 and like what I see so far. How is datetime
arithmatic performed in postgres. I have a table with start date/time
and end date/time(datetime data type) fields and want to set the default
end time to 1 hour later than the start time. Is there a way to do
this. My attempts to set the default value for the field using:

starttime datetime default now(),
endtime datetime default now() + xxx.xxx,

has yielded only either a datetime with time set to 00:00 or only a
date!

Thanks for the help.

Stuart

#2Gyozo Papp
pgerzson@freestart.hu
In reply to: Stuart (#1)
Re: datetime arithmatic

Maybe this helps you:

starttime datetime default now(),
endtime datetime default (now() + interval('1 hour'))

----- Original Message -----
From: "Stuart" <sfbarbee@yahoo.com>
To: <pgsql-general@postgresql.org>
Sent: 2001. �prilis 30. 21:18
Subject: [GENERAL] datetime arithmatic

Show quoted text

Folks,

I am new to postgresql 7.1 and like what I see so far. How is datetime
arithmatic performed in postgres. I have a table with start date/time
and end date/time(datetime data type) fields and want to set the default
end time to 1 hour later than the start time. Is there a way to do
this. My attempts to set the default value for the field using:

starttime datetime default now(),
endtime datetime default now() + xxx.xxx,

has yielded only either a datetime with time set to 00:00 or only a
date!

Thanks for the help.

Stuart

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster