Re: [SQL] merging date and time

From: Oliver Smith <oliver(at)kfs(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] merging date and time
Date: 1999-03-31 16:16:11
Message-ID: 19990331171611.B12083@kfs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Mar 31, 1999 at 10:01:20AM -0600, Ross J. Reedstrom wrote:
> test=> create table t1 (d date, t text);
> CREATE
> test=> insert into t1 values('22-03-1999','14:45:27');
> INSERT 101293 1
> test=> select datetime(d+timespan(t)) from t1;
> datetime
> ----------------------------
> Mon Mar 22 14:45:27 1999 CST
> (1 row)
>
> test=> drop table t1;
> DROP
> test=>

Or more simply...

select ('22-03-1999'::date + '14:45:27'::timespan) as myDateTime;
mydatetime
----------------------------
Mon Mar 22 14:45:27 1999 GMT
(1 row)

--
If at first you don't succeed, skydiving is not for you...

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jackson, DeJuan 1999-03-31 16:54:01 RE: [SQL] Odd "problem", not sure if there is a solution ....
Previous Message Ross J. Reedstrom 1999-03-31 16:01:20 Re: [SQL] merging date and time