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

From: Joel Burton <joel(at)joelburton(dot)com>
To: "Ron St(dot)Pierre" <rstpierre(at)syscor(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Create Timestamp From Date and Time AGAIN (REPOST)
Date: 2002-12-04 16:38:23
Message-ID: 20021204163823.GA16179@temp.joelburton.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Independent Knowledge Management Consultant

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-12-04 16:40:48 Re: Backend message type 0x50 arrived while idle
Previous Message Ron St.Pierre 2002-12-04 16:24:37 Re: Create Timestamp From Date and Time AGAIN (REPOST)