to_char(now(), 'YYYY') and time zones

From: Simon Bæk Carstensen <simonbc(at)email(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: to_char(now(), 'YYYY') and time zones
Date: 2001-04-12 11:39:45
Message-ID: 3AD59401.46105E2@email.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Konstantinos Agouros 2001-04-12 11:50:43 Re: : Re: Very long running query
Previous Message Dennis Fleurbaaij 2001-04-12 11:14:47 Extreme preformance