Timestamps and Time Zones in PostgreSQL (2016)
I completely disagree with this advice:<p>&gt; However, when you come across timestamp, you can’t possibly know in what time zone the timestamp is just by looking at it.<p>yes I do, it&#x27;s in UTC, because I assume the application is written to correctly handle datetimes.<p>&gt; It is merely a wall time. Maybe it’s UTC,<p>no, it&#x27;s UTC.<p>&gt; or maybe the developer stored it in local time.<p>right, maybe the application was not programmed correctly, that is always a possibility. But if they are using the timestamp with timezone datatype, it is 100% more likely they have made mistakes in doing so because it is much more confusing to have to fight against PostgreSQL&#x27;s assumptions and implicit conversions, as the complexity of its behaviors and decisions using this datatype are described in this article.   Does the application come up with the wrong answer if the server it runs on, or the webserver container, is mistakenly set to Eastern Timezone rather than UTC?   Is the application ensuring that it knows the correct timezone of timestamps <i>as they enter the application</i>, and if so, why isn&#x27;t it converting to UTC <i>at that moment</i>?   Is the application otherwise receiving datetimes of arbitrary timezone, letting them move around business and display logic in their raw form, and waiting until they enter <i>the database</i> to be correctly normalized?  that&#x27;s too late.<p>A correctly coded application does <i>explicit</i> normalization of datetime values the moment they enter the boundaries of the application, just like it would also convert encoded bytes into a unicode-aware strings up front, so that within the application there is no ambiguity, both when persisting and when handling.