Thread: storage, entry, display of dates with/out time zone

storage, entry, display of dates with/out time zone

From
Dennis Gearon
Date:
According to the 'User' manual:

    "All dates and times are stored internally in UTC, traditionally known
as Greenwich Mean Time (GMT). Times are converted to local time on the
database server before being sent to the client frontend, hence by
default are in the server time zone."

This means that date/times with no TZ modifier are still stored relative
to UTC/GMT? If the data were sent over seas, i.e. replication, then ANY
DATE/TIME  would display different, because of the timezone change?

An example of what I think this means:

An accounting program in Postgres is based in the US. At the end of the
last day of the month, late fees become chargable against
procrasintators like me. The accounting program is running in Pacific
Standard time and runs the batch file for late fees on the 5th of the
month. Some Russian guy who has an account and lives 12 hours ahead,
pays his bill through paypal and it gets credited at 11:59, the first
day of the month (local time). Neglecting Daylight savings time, his
payment is effectively paid 1 minute before the deadline, PST(west usa).

No matter whether the database used timestamp or timestamptz, as long as
there was correct or no altering timezone information put in the
UPDATE/INSERT statement for his credited payment, he would be OK? Do I
have this right?

What I'm basically trying to find out is how useful a column with
timestamptz vs timestamp is. Why use one versus the other? Is it
possible to convert that UTC/GMT value stored from it's original
timestamp column type value to timestamptz and visa versa?