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

From Simon Bæk Carstensen
Subject to_char(now(), 'YYYY') and time zones
Date
Msg-id 3AD59401.46105E2@email.com
Whole thread Raw
List pgsql-general
I'm trying to pull the current year with the following query:

select to_char(now(), 'YYYY');

This is fine. Now, I would like to select this date in different time
zones.

Normally I just do:

select now() at time zone 'utc';

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).

I guess I should do some sort of subselect like:

select to_char(utc, 'YYYYY') from (select now() as utc at time zone
'utc')

But that jsut gives me an error.

Does anyone know how to do this?


-- Simon Carstensen


pgsql-general by date:

Previous
From: Marek PUBLICEWICZ
Date:
Subject: Re: System tables
Next
From: elwood@agouros.de (Konstantinos Agouros)
Date:
Subject: Re: : Re: Very long running query