Re: timestamp (military) at time zone without the suffix

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: timestamp (military) at time zone without the suffix
Дата
Msg-id 7ed86867-5805-3547-2974-402af6f1ac88@aklaver.com
обсуждение исходный текст
Ответ на timestamp (military) at time zone without the suffix  (David Gauthier <davegauthierpg@gmail.com>)
Список pgsql-general
On 07/11/2018 12:36 PM, David Gauthier wrote:
> Hi:
> 
> I would like to get the utc timestamp, 24-hr clock (military time), 
> without the time zone suffix.
> 
> Below commands were run nearly at the same time...
> 
> sqfdev=> select now()::timestamp(0)  ;
>           now
> ---------------------
>   2018-07-11 15:27:12
> (1 row)
> 
> ...then immediately...
> 
> sqfdev=> select now()::timestamp(0) at time zone 'utc' ;
>          timezone
> ------------------------
>   2018-07-11 11:27:12-04
> (1 row)
> 
> 
> 15:27:12 makes sense (it's a bout 3:30 in the afternoon EST).
> 11:27:12 doesn't make sense.  UTC is 5 hours ahead.  I would have 
> expected either 20:27 (if it stuck to military time, which I want), or 
> 08:27 (P.M., non-military time)
> 
> And I want to get rid of the -04 suffix.
> 
> Is there a way to do this ?

test=> show TimeZone;
   TimeZone
------------
  US/Pacific
(1 row)

test=> select now();
               now
------------------------------- 
 

  2018-07-11 12:44:57.757347-07 
 

(1 row) 
 

 
 

test=> select (now() at time zone 'UTC')::timestamp(0);
       timezone 
 

--------------------- 
 

  2018-07-11 19:45:00 
 

(1 row)



> 
> Thanks !


-- 
Adrian Klaver
adrian.klaver@aklaver.com


В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: timestamp (military) at time zone without the suffix
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: timestamp (military) at time zone without the suffix