AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
![]() Input is internally converted to UTC, and that's how it's stored. How it looks (how many hours, minutes, etc.) depends on your time zone, but it always refers to the same "physical" instant (like the moment of an actual physical event). TIMESTAMP WITH TIME ZONE stores a point on the UTC time line. Also, any offset or time zone you specify in the input is ignored by PostgreSQL, so ' 06:30:30+00' and ' 06:30:30+05' are the same as just ' 06:30:30'.įor Java developers: it's analogous to. If the value was entered into the database as ' 06:30:30', then no mater in what time zone you display it later, it will still say year 2011, month 07, day 01, 06 hours, 30 minutes, and 30 seconds (in some format). Hence, PostgreSQL does no time zone related conversion on input or output. Its time zone is unspecified as far as PostgreSQL can tell (though your application may knows what it is). TIMESTAMP WITHOUT TIME ZONE stores local date-time (aka. The difference is in the interpretation of the stored data (and in the intended application), not in the storage format itself: Neither TIMESTAMP variants store a time zone (or an offset), despite what the names suggest. ![]() I try to explain it more understandably than the referred PostgreSQL documentation. Here are examples covering the combinations of those factors: foo=> SET TIMEZONE TO 'Japan' įoo=> SELECT ' 00:00:00'::TIMESTAMP WITH TIME ZONE įoo=> SELECT ' 00:00:00+03'::TIMESTAMP WITH TIME ZONE įoo=> SET TIMEZONE TO 'Australia/Melbourne'
0 Comments
Read More
Leave a Reply. |