![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm trying to determine the best way of saying 'The current time in UTC with no time zone information'. |
#3
| |||
| |||
|
|
Stuart Bishop <stuart (AT) stuartbishop (DOT) net> writes: I'm trying to determine the best way of saying 'The current time in UTC with no time zone information'. Isn't that a contradiction in terms? |
|
But anyone who is worried about timezones and yet is storing his data in timestamp-without-time-zone columns probably needs to reconsider exactly what his data represents. |
#4
| |||
| |||
|
|
I'm trying to determine the best way of saying 'The current time in UTC with no time zone information'. Isn't that a contradiction in terms? Not if you're used to the Unix concept of storing "seconds since the epoch". In that model the quantity you're storing is entirely time zone agnostic. But then one is storing an interval, not a point in time. |
#5
| |||
| |||
|
|
I'm trying to determine the best way of saying 'The current time in UTC with no time zone information'. Isn't that a contradiction in terms? Not if you're used to the Unix concept of storing "seconds since the epoch". In that model the quantity you're storing is entirely time zone agnostic. But then one is storing an interval, not a point in time. |
#6
| |||
| |||
|
|
Tom Lane <tgl (AT) sss (DOT) pgh.pa.us> writes: Stuart Bishop <stuart (AT) stuartbishop (DOT) net> writes: I'm trying to determine the best way of saying 'The current time in UTC with no time zone information'. Isn't that a contradiction in terms? Not if you're used to the Unix concept of storing "seconds since the epoch". In that model the quantity you're storing is entirely time zone agnostic. |
|
The SQL approach of storing a time zone with the timestamp makes things very confusing. For unix people it requires a time zone in precisely the opposite circumstances from when they expect to use one. |
|
It could be useful to represent "3pm in your local time zone" which can be useful for some purposes. |
#7
| |||
| |||
|
|
Greg Stark <gsstark (AT) mit (DOT) edu> writes: Tom Lane <tgl (AT) sss (DOT) pgh.pa.us> writes: Stuart Bishop <stuart (AT) stuartbishop (DOT) net> writes: I'm trying to determine the best way of saying 'The current time in UTC with no time zone information'. Isn't that a contradiction in terms? Not if you're used to the Unix concept of storing "seconds since the epoch". In that model the quantity you're storing is entirely time zone agnostic. Not at all. In my worldview, the Unix concept is "seconds since midnight 1/1/1970 00:00 UTC", and therefore it is essentially UTC time, because (a) its absolute meaning doesn't change depending on your local timezone, but (b) unless you are in UTC, you have to rotate it to your local timezone for display. |
|
The SQL approach of storing a time zone with the timestamp makes things very confusing. For unix people it requires a time zone in precisely the opposite circumstances from when they expect to use one. Yes, obviously you are confused ;-) |
#8
| |||
| |||
|
|
I guess my confusion comes from the way postgres interprets unadorned time stamps as being in local time. And then always displays timestamps converted to local time. I thought it was remembering the time zone specified in the original input. In fact it's not doing that. |
#9
| |||
| |||
|
|
Greg Stark <gsstark (AT) mit (DOT) edu> writes: I guess my confusion comes from the way postgres interprets unadorned time stamps as being in local time. And then always displays timestamps converted to local time. I thought it was remembering the time zone specified in the original input. In fact it's not doing that. Indeed not. (I think that the SQL spec contemplates that TIMESTAMP WITH TIME ZONE *should* work that way, but that's not what we've done.) |

|
Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a tool for doing 5% of the work and then sitting around waiting for someone else to do the other 95% so you can sue them. |
#10
| |||
| |||
|
|
Stuart Bishop <stuart (AT) stuartbishop (DOT) net> writes: I'm trying to determine the best way of saying 'The current time in UTC with no time zone information'. Isn't that a contradiction in terms? |
|
I *think* maybe what you want is to SET TIMEZONE = 'UTC' and then stop worrying about it. But anyone who is worried about timezones and yet is storing his data in timestamp-without-time-zone columns probably needs to reconsider exactly what his data represents. What is it that you actually want to store, and how do you want it presented? |
![]() |
| Thread Tools | |
| Display Modes | |
| |