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

From: "Ron St(dot)Pierre" <rstpierre(at)syscor(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Create Timestamp From Date and Time AGAIN (REPOST)
Date: 2002-12-04 16:24:37
Message-ID: 9%pH9.160408$ka.3558317@news1.calgary.shaw.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

> Tom Lane wrote:
>
>> "Ron St.Pierre" <rstpierre(at)syscor(dot)com> writes:
>>
>>
>>> Example - when I run the following:
>>> select timestamp(date '1998-02-24',time '23:07')
>>> I get the following error:
>>> parse error at or near "date"
>>>
>>
>>
>> "timestamp" is a reserved word these days, so to use it as a function
>> name you must double-quote it.
>>
>
>> regression=# select "timestamp"(date '1998-02-24',time '23:07');
>> timestamp
>> ---------------------
>> 1998-02-24 23:07:00
>> (1 row)
>>
>> regards, tom lane
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 4: Don't 'kill -9' the postmaster
>>
>>
>

--
Ron St.Pierre
Syscor R&D
tel: 250-361-1681
email: rstpierre(at)syscor(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joel Burton 2002-12-04 16:38:23 Re: Create Timestamp From Date and Time AGAIN (REPOST)
Previous Message Tom Lane 2002-12-04 16:19:38 Re: Drop column and Access