Determine Time in other Time Zone

From: Marc Wrubleski <mlwruble(at)sorexsoftware(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Determine Time in other Time Zone
Date: 2001-03-10 02:18:00
Message-ID: 3AA98ED8.C82F3C6C@sorexsoftware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I need to determine the users time in another Time Zone for the time
now().

I tried to manually add or subtract the difference of hours between the
server timezone and the other timezone, but I have to do it for _Every_
timezone. Not only that, but I need to take Daylight Saving Time (DST)
into account for those timezones that use it.

I have tried the timezone(text,timestamp) function, but for that to work
with daylight savings time I need to know whether the DST is being
applied for this date. Ie I have to give the function either MST or MDT,
and I don't know how to switch it based on now() and the timezone.

I know that I can set the postgres timezone to a timezone defined within
Linux's /usr/share/zoneinfo, and that adjusts the local time properly
including DST.

What I want is a way to ask for the time in a different time zone and
use the Linux zoneinfo to calculate it.

Does anyone know have an idea how I can solve this problem? Would anyone
else be able to use this functionality?

Marc Wrubleski
Sorex Software Inc.
Calgary, Alberta, Canada
1 (403) 371-7598

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gordon A. Runkle 2001-03-10 02:18:28 Re: COPY problem
Previous Message Ben 2001-03-10 02:12:06 Re: what's going on here?