Re: to_char(now(), 'YYYY') and time zones - Mailing list pgsql-general

From Alessio Bragadini
Subject Re: to_char(now(), 'YYYY') and time zones
Date
Msg-id 3AD5B5BE.3D875E70@albourne.com
Whole thread Raw
In response to to_char(now(), 'YYYY') and time zones  (Simon Bæk Carstensen <simonbc@email.com>)
List pgsql-general
Simon Bæk Carstensen wrote:

> I guess I need a combination of the 2 queries above - one that asks for
> ONLY the year in a certain time zone (fx UTC or CET).

The easiest way is to do

SET TimeZone TO 'CET';

[from now on all timestamps will be returned CET-base]

SELECT ...

You can then

SET TimeZone TO DEFAULT;

or wait for the end of the connection.

--
Alessio F. Bragadini        alessio@albourne.com
APL Financial Services        http://village.albourne.com
Nicosia, Cyprus             phone: +357-2-755750

"It is more complicated than you think"
        -- The Eighth Networking Truth from RFC 1925

pgsql-general by date:

Previous
From: Michael Ansley
Date:
Subject: RE: to_char(now(), 'YYYY') and time zones
Next
From: Louis-David Mitterrand
Date:
Subject: no OID field in OLD or NEW records inside trigger functions?