Re: Joining dates/times (was Re: Splitting Timestamps)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Joining dates/times (was Re: Splitting Timestamps)
Date: 2006-07-30 16:00:55
Message-ID: 25707.1154275255@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> writes:
> What's the inverse? Say I have a DATE and a TIME, and want to
> create a TIMESTAMP with them?

Add 'em together, using the "date + time" or "date + timetz" operator:

regression=# select current_date + '11:57'::time;
?column?
---------------------
2006-07-30 11:57:00
(1 row)

regression=# select current_date + '11:57-04'::timetz;
?column?
------------------------
2006-07-30 11:57:00-04
(1 row)

See "Date/Time Operators" in the manual. I believe these operations
are SQL-standard.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2006-07-30 16:04:04 Re: New variable server_version_num
Previous Message Florian G. Pflug 2006-07-30 15:29:39 Re: Questions about update, delete, ctid...