pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedTimezone conversion
7+ messages / 7 participants
[nested] [flat]
* Timezone conversion
@ 2001-04-12 02:08 Roberto Mello <rmello@cc.usu.edu>
2001-04-19 00:32 ` Re: Timezone conversion Grant <grant@conprojan.com.au>
0 siblings, 1 reply; 7+ messages in thread
From: Roberto Mello @ 2001-04-12 02:08 UTC (permalink / raw)
To: pgsql-sql
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.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Timezone conversion
2001-04-12 02:08 Timezone conversion Roberto Mello <rmello@cc.usu.edu>
@ 2001-04-19 00:32 ` Grant <grant@conprojan.com.au>
2001-04-24 10:16 ` Re: Timezone conversion Cedar Cox <cedarc@visionforisrael.com>
0 siblings, 1 reply; 7+ messages in thread
From: Grant @ 2001-04-19 00:32 UTC (permalink / raw)
To: Roberto Mello <rmello@cc.usu.edu>; +Cc: pgsql-sql
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).
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Timezone conversion
2001-04-12 02:08 Timezone conversion Roberto Mello <rmello@cc.usu.edu>
2001-04-19 00:32 ` Re: Timezone conversion Grant <grant@conprojan.com.au>
@ 2001-04-24 10:16 ` Cedar Cox <cedarc@visionforisrael.com>
2001-04-24 11:54 ` RE: Timezone conversion Francis Solomon <francis@stellison.co.uk>
0 siblings, 1 reply; 7+ messages in thread
From: Cedar Cox @ 2001-04-24 10:16 UTC (permalink / raw)
To: Grant <grant@conprojan.com.au>; +Cc: Roberto Mello <rmello@cc.usu.edu>; pgsql-sql
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
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* RE: Timezone conversion
2001-04-12 02:08 Timezone conversion Roberto Mello <rmello@cc.usu.edu>
2001-04-19 00:32 ` Re: Timezone conversion Grant <grant@conprojan.com.au>
2001-04-24 10:16 ` Re: Timezone conversion Cedar Cox <cedarc@visionforisrael.com>
@ 2001-04-24 11:54 ` Francis Solomon <francis@stellison.co.uk>
0 siblings, 0 replies; 7+ messages in thread
From: Francis Solomon @ 2001-04-24 11:54 UTC (permalink / raw)
To: Cedar Cox <cedarc@visionforisrael.com>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Timezone conversion
@ 2003-02-14 01:04 Jeff Boes <jboes@qtm.net>
2003-02-14 18:00 ` Re: Timezone conversion Stephan Szabo <sszabo@megazone23.bigpanda.com>
0 siblings, 1 reply; 7+ messages in thread
From: Jeff Boes @ 2003-02-14 01:04 UTC (permalink / raw)
To: pgsql-sql
Is there a straightforward way to change the display of a time to another
timezone? For example, my server's environment is EST (-0500); I want to
convert timestamps for display in PST (-0800). What I've been doing is to use a
Pl/Pgsql function to subtract the current timezone-offset and add in the desired
one. Is there a way to do it without arithmetic?
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Timezone conversion
2003-02-14 01:04 Timezone conversion Jeff Boes <jboes@qtm.net>
@ 2003-02-14 18:00 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2003-02-14 21:08 ` Re: Timezone conversion Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 7+ messages in thread
From: Stephan Szabo @ 2003-02-14 18:00 UTC (permalink / raw)
To: Jeff Boes <jboes@qtm.net>; +Cc: pgsql-sql
On Thu, 13 Feb 2003, Jeff Boes wrote:
> Is there a straightforward way to change the display of a time to another
> timezone? For example, my server's environment is EST (-0500); I want to
> convert timestamps for display in PST (-0800). What I've been doing is to use a
> Pl/Pgsql function to subtract the current timezone-offset and add in the desired
> one. Is there a way to do it without arithmetic?
I think you might be able to use "AT TIME ZONE" to do what you want. I
think it's described in Chapter 6 of the user's guide.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Timezone conversion
2003-02-14 01:04 Timezone conversion Jeff Boes <jboes@qtm.net>
2003-02-14 18:00 ` Re: Timezone conversion Stephan Szabo <sszabo@megazone23.bigpanda.com>
@ 2003-02-14 21:08 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 7+ messages in thread
From: Tom Lane @ 2003-02-14 21:08 UTC (permalink / raw)
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>; +Cc: Jeff Boes <jboes@qtm.net>; pgsql-sql
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> On Thu, 13 Feb 2003, Jeff Boes wrote:
>> Is there a straightforward way to change the display of a time to another
>> timezone? For example, my server's environment is EST (-0500); I want to
>> convert timestamps for display in PST (-0800).
> I think you might be able to use "AT TIME ZONE" to do what you want. I
> think it's described in Chapter 6 of the user's guide.
Also, there's always the straightforward approach: temporarily change
the TIMEZONE variable ;-)
I believe AT TIME ZONE is new in 7.3.
regards, tom lane
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2003-02-14 21:08 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-12 02:08 Timezone conversion Roberto Mello <rmello@cc.usu.edu>
2001-04-19 00:32 ` Grant <grant@conprojan.com.au>
2001-04-24 10:16 ` Cedar Cox <cedarc@visionforisrael.com>
2001-04-24 11:54 ` Francis Solomon <francis@stellison.co.uk>
2003-02-14 01:04 Timezone conversion Jeff Boes <jboes@qtm.net>
2003-02-14 18:00 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2003-02-14 21:08 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox