Re: Create Timestamp From Date and Time AGAIN (REPOST)

Поиск
Список
Период
Сортировка
От Joel Burton
Тема Re: Create Timestamp From Date and Time AGAIN (REPOST)
Дата
Msg-id 20021204163823.GA16179@temp.joelburton.com
обсуждение исходный текст
Ответ на Re: Create Timestamp From Date and Time AGAIN (REPOST)  ("Ron St.Pierre" <rstpierre@syscor.com>)
Список pgsql-general
On Wed, Dec 04, 2002 at 04:24:37PM +0000, Ron St.Pierre wrote:
> REPOST -> with correct email address
>
> Ron wrote:
> Thanks, that works but I am still having problems extracting both the
> date and time from a table and converting them into a timestamp,
> specifically with the 'time' column. Here's an example of the data:
> cntuserid |      dtmstartdate                |    dtmstarttime
> -----------+------------------------+---------------------
>     2119 | 2000-05-10 00:00:00-07 | 1899-12-30 19:32:33
>     2119 | 2000-05-10 00:00:00-07 | 1899-12-30 19:36:30
>
> I want to combine the 'date' part of 'dtmstartdate' with the 'time'
> portion of 'dtmstarttime', dynamically, to form something like:
> cntuserid |      dtmstart -----------+------------------------
>     2119 | 2000-05-10 19:32:33
>     2119 | 2000-05-10 19:36:30
>
> Thanks to previous help I can get the date, but I just don't know how to
> get the time to work. I've tried RTFM, the web, discussion groups, tried
> functions, etc
>
> BTW I'm migrating an Access db to PostgreSQL v 7.2.1 (soon to be 7.3). I
> also don't care whether the result is timestamp or timestamptz, both
> would work. Thanks

create table addtime (usedate timestamp, usetime timestamp);

insert into addtime values ('2002-01-01 9:00 AM', '2002-01-05 10:30
AM');

select date(usedate) + cast(usetime as time with time zone) from
addtime;

--

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant

В списке pgsql-general по дате отправления:

Предыдущее
От: "Ron St.Pierre"
Дата:
Сообщение: Re: Create Timestamp From Date and Time AGAIN (REPOST)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Backend message type 0x50 arrived while idle