![]() SELECT timestamp with time zone ' 00:00:00' We can see the timezone offset that was used by selecting the input value directly. This means that my local timezone is six hours ahead of Indian/Mauritius. In this case, the resulting timestamp has been put back six hours. SELECT timezone('Indian/Mauritius', timestamp with time zone ' 00:00:00') The resulting timestamp is shifted according to the input timezone.Īnd if you specify timestamp with time zone, but the original timestamp doesn’t actually include a timezone, then the original timestamp value is shifted to the local timezone. SELECT timezone('Indian/Mauritius', timestamp with time zone ' 00:00:00+01') Here’s what happens if I change the timezone of the input timestamp. When the original timestamp includes the timezone, the timezone() function shifts the original timestamp value to the specified time zone, and returns the value without a timezone. SELECT timezone('Indian/Mauritius', timestamp with time zone ' 00:00:00+00') Here’s what happens when the original timestamp includes the timezone. Example 1 -When the Original Timestamp DOES Include the Timezone ![]() ![]() The result you get will depend on whether the original timestamp value includes a timezone or not (and what that value is). Where zone is the timezone that you want the timestamp argument to be converted to. The syntax goes like this: timezone(zone, timestamp) In PostgreSQL, you can use the timezone() function to convert a timestamp to another timezone.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |