![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Of course this is wrong since DST is in affect, so it should be 'pdt' not 'pst'. I understand that postgresql doesn't do this itself, it uses the OS, however does anyone know a crafty way to get the current time in any timezone, whether DST is in effect or not? |
#3
| |||
| |||
|
|
I need a method of returning a date in a given timezone and accomidating DST. For example, my server is set to UTC, Id like to return the epoch for Vancouver Canada. |
#4
| |||
| |||
|
|
A Gilmore <agilmore (AT) shaw (DOT) ca> writes: I need a method of returning a date in a given timezone and accomidating DST. For example, my server is set to UTC, Id like to return the epoch for Vancouver Canada. Huh? Epoch is UTC all over the world, at least for sane operating systems. But disregarding your specific example, the general problem is valid. I'm afraid there's not a real good solution at the moment. You should ideally be able to say select now() at time zone 'PST8PDT'; .... In the meantime, the only solution I can suggest is pretty klugy: temporarily set the TIMEZONE variable. For example, I'm in EST5EDT, so: regression=# select now(); now ------------------------------- 2004-09-18 15:57:26.944637-04 (1 row) regression=# begin; BEGIN regression=# set local timezone = 'PST8PDT'; SET regression=# select extract(hour from cast(now() as timestamp without time zone)); date_part ----------- 12 (1 row) regression=# commit; COMMIT |
#5
| |||
| |||
|
|
I have table holding timestamps without a time zone (considered GMT). Ill being making inserts into this table with a timestamp like 3pm PST, which I need to be translated and inserted as GMT. Later this will likely be queried where I need the timestamp returned for say EST. |
![]() |
| Thread Tools | |
| Display Modes | |
| |