The PostgreSQL documentation is fairly thorough and useful:
https://www.postgresql.org/docs/9.2/datatype-datetime.html#DATATYPE-TIMEZONES
but seems to overlook clarity on a rather useful point where clarity might be warranted and help. Having read the documentation and various related stackoverflow questions and responses, I am left suspecting that the following is true:
The PostgreSQL datatype
timestamp with timezone
stores a date and time and a utcoffset (+ve being east of Greenwich)
I would further infer and suspect it is true that:
The PostgreSQL datatype
timestamp with timezone
stores a date and time and a utcoffset (+ve being east of Greenwich) to minute resolution.
My question relates to these inferences. Are they correct, and if so what evidence can be forwarded to confirm them, and if not what evidence can be forwarded to the contrary.
The main reason this is interesting is because of course if true, then PostgreSQL which accepts timezones by name or abbreviation as stored in the table pg_timezone_names
only stores the UTC offset and thereby loses DST information.
Meaning, to make the actual time zone name (as defined in the table pg_timezone_names
) available to a reader in the future it must be explicitly stored alongside the timestamp with timezone
in a column beside it.
The main reason this interests me right now is that I had in mind what I felt was a reasonably clever way of rendering times that can record the time of an event anywhere on earth. Namely if the recorded time is in the users current timezone, then report it as a naive date/time (no timezone info), and only if it is in a timezone different to the readers, report the timezone information (and even then, the timezone name may be more user friendly than the UTC offset).
And it looks like I will be obliged to store timezone name beside my event times (and any other timezone aware date/time's I store) if I wish to implement such contextually sensitive rendering on a website.
But I feel ill at ease making such a commitment on the basis of inference, and not knowledge and would like some evidence supporting or contradicting these inferences.
... at time zone ...
and provide the user's time zone – Anthology