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

Поиск
Список
Период
Сортировка
От Simon Bæk Carstensen
Тема to_char(now(), 'YYYY') and time zones
Дата
Msg-id 3AD58970.5A3F67BE@email.com
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Jason Larke
Дата:
Сообщение: Timestamps for BLOB fields
Следующее
От: John Havard
Дата:
Сообщение: Re: Using pl/pgsql or sql for in/out functions for types