Обсуждение: Timezone conversion

Поиск
Список
Период
Сортировка

Timezone conversion

От
Roberto Mello
Дата:
Hi,
How can I do timezone conversions in PG? I looked on the docs and
couldn't find how. I want to find the current time in another timezone.
Thanks,
-Roberto

P.S: This type of function would be excellent on the cookbook
(www.brasileiro.net).
-- 
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+ Roberto Mello - Computer Science, USU -
http://www.brasileiro.net      http://www.sdl.usu.edu - Space Dynamics Lab, Developer    
 
Ad astra, per ardua nostra.


Re: Timezone conversion

От
Grant
Дата:
Convert it to timestamp and minus TIMEZONE * 3600...

On Wed, 11 Apr 2001, Roberto Mello wrote:

>     Hi,
> 
>     How can I do timezone conversions in PG? I looked on the docs and
> couldn't find how. I want to find the current time in another timezone.
> 
>     Thanks,
> 
>     -Roberto
> 
> P.S: This type of function would be excellent on the cookbook
> (www.brasileiro.net).
> 



Re: Timezone conversion

От
Cedar Cox
Дата:
Umm.. define 'it'.  (Isn't current_timestamp or now() already a
timestamp?)

select CURRENT_TIMESTAMP, CURRENT_TIMESTAMP-2*3600;      timestamp        |  ?column?  
------------------------+------------2001-04-24 13:06:11+03 | 1981-08-07

I also have a question.. How, for example, would I add 90 days to the
current timestamp?

Thanks,
-Cedar


On Thu, 19 Apr 2001, Grant wrote:

> Convert it to timestamp and minus TIMEZONE * 3600...
> 
> On Wed, 11 Apr 2001, Roberto Mello wrote:
> 
> >     Hi,
> > 
> >     How can I do timezone conversions in PG? I looked on the docs and
> > couldn't find how. I want to find the current time in another timezone.
> > 
> >     Thanks,
> > 
> >     -Roberto
> > 
> > P.S: This type of function would be excellent on the cookbook
> > (www.brasileiro.net).
> > 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://www.postgresql.org/search.mpl
> 



RE: Timezone conversion

От
"Francis Solomon"
Дата:
Hi Cedar,

Does this help?

select CURRENT_TIMESTAMP, CURRENT_TIMESTAMP + '90 days';
      timestamp        |        ?column?        
------------------------+------------------------2001-04-24 12:57:56+01 | 2001-07-23 12:57:56+01

> 
> I also have a question.. How, for example, would I add 90 days to the
> current timestamp?
> 
> Thanks,
> -Cedar