Re: Convert date and time colums to datetime - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Convert date and time colums to datetime
Date
Msg-id 6b30ebac-6d6d-4c26-be73-de67e208e4e1@aklaver.com
Whole thread Raw
In response to Convert date and time colums to datetime  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Convert date and time colums to datetime
Re: Convert date and time colums to datetime
List pgsql-general
On 10/19/25 07:43, Rich Shepard wrote:
> The database has a table with separate date and time columns.
> 
> 1. Are there benefits to merging the two into a single timestamp column?

1) One less column to fetch from.

2) If you really need a timestamp the work is already done, instead of 
building on the fly.

> 
> 2. If so, how would I do this? (Reading date/time operators and functions
> doc page hasn't shown me one.)

select ('10/19/2025'::date + '07:50'::time)::timestamptz;

timestamptz
------------------------
  2025-10-19 07:50:00-07

> 
> TIA,
> 
> Rich
> 
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Convert date and time colums to datetime
Next
From: Adrian Klaver
Date:
Subject: Re: Convert date and time colums to datetime