![]() In other words, we are asking: what was the absolute point in time when the clock in Los Angeles showed 00:00? In example 2 we are doing the opposite, namely taking a timestamp and converting it to a timestamptz. what the clock in Los Angeles showed at that absolute point in time. In other words, it is converting the absolute point in time 00:00Z to a wall time in US/Pacific, i.e. Since we are giving it a timestamptz as input, it'll output a timestamp. We know that the timezone function converts back and forth between timestamp and timestamptz: Postgres implicitly converted the string to a timestamptz. This is equivalent to SELECT timezone('US/Pacific', ' 00:00'::timestamptz), i.e. Please explain how the timezone behaves when gets a timestamp and gets asked to transform it. So it is automatically converted to US/Pacific? Then the output is in UTC? But why? I asked for a US/Pacific in my timezone not a UTC. In what timezone? If it is UTC, the output would have to be the same as the Example 1. Ok, the ' 00:00'::timestamp part of the timezone function is no longer a string, but an actual timestamp. So from ' 00:00' UTC it is then converted to US/Pacific as asked by the timezone function, that is 16:00:00.Įxample 2 db=# SELECT timezone('US/Pacific', ' 00:00'::timestamp) outputs 08:00:00+00Įxcuse me, I dont see why and the explanation there does not help. (Consider the default timezone configuration to be UTC.)Įxample 1 db=# SELECT timezone('US/Pacific', ' 00:00') outputs 16:00:00Īccording to the article and what I understand, because the ' 00:00' part of the timezone function is just a string, it is silently converted to the default UTC. I think I got it, until I red this article.įocus on the "Converting Between Timezones" part. ![]() I am trying to understand the timestamps and timezones in Postgre. ![]()
0 Comments
Leave a Reply. |