From: | Melvin Davidson <melvin6925(at)gmail(dot)com> |
---|---|
To: | Benjamin Adams <benjamindadams(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: timestamp without timezone to have timezone |
Date: | 2016-11-06 15:10:15 |
Message-ID: | CANu8Fixi+hJ_5H=Km5s8MMR76M1tNcqXTJWNHRFktfo+4OQRLw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sun, Nov 6, 2016 at 9:11 AM, Benjamin Adams <benjamindadams(at)gmail(dot)com>
wrote:
> I have a server that has a column timestamp without timezone.
>
> Is the time still saved?
> if I select column with timestamp it will show server timestamp with
> timezone.
>
> But If I move the data from EST to Central will the timestamp with
> timezone be correct?
> Or will it just not make the adjustment?
>
> Thanks
> Ben
>
*>But If I move the data from EST to Central will the timestamp with
timezone be correct?The correct way to do that is to use the AT TIME ZONE
function.https://www.postgresql.org/docs/9.4/static/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT
<https://www.postgresql.org/docs/9.4/static/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT>*
*eg:*
*postgres=> SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'EST'
as Eastern,postgres-> TIMESTAMP '2001-02-16 20:38:40' AT TIME
ZONE 'CST' as Central,postgres-> TIMESTAMP '2001-02-16
20:38:40' AT TIME ZONE 'MST' as Mountain,postgres-> TIMESTAMP
'2001-02-16 20:38:40' AT TIME ZONE 'PST' as Pacific; eastern
| central | mountain |
pacific------------------------+------------------------+------------------------+------------------------
2001-02-16 20:38:40-05 | 2001-02-16 21:38:40-05 | 2001-02-16
22:38:40-05 | 2001-02-16 23:38:40-05(1 row)
*
*-- *
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2016-11-06 16:07:56 | Re: timestamp without timezone to have timezone |
Previous Message | Benjamin Adams | 2016-11-06 14:11:57 | timestamp without timezone to have timezone |