On Sun, Nov 6, 2016 at 9:11 AM, Benjamin Adams <benjamindadams@xxxxxxxxx> 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?ThanksBen
>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
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.
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.