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

Поиск
Список
Период
Сортировка
От David Gauthier
Тема Re: timestamp (military) at time zone without the suffix
Дата
Msg-id CAMBRECBnkee2fG3kWFCFFRfk=Eq40obKkzOL1181H_phZhRtRA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: timestamp (military) at time zone without the suffix  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: timestamp (military) at time zone without the suffix
Re: timestamp (military) at time zone without the suffix
Список pgsql-general
OK, the "to_char" gets rid of the timezone extension.  But the times still don't make sense.  

UTC should be 5 hours ahead, not behind.  It should be EST plus 5 hours (or 4 for DST), not minus.  That's why I said I expected 20:27 .  


When I go to store this in a DB, I want to store the UTC time.  How d I do that ? 

insert into foo (dt) values (localtimestamp(0) at time zone 'utc') ???   


On Wed, Jul 11, 2018 at 3:45 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wednesday, July 11, 2018, David Gauthier <davegauthierpg@gmail.com> 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.
 
Apparently it's only four hours ahead of your server's time zone setting. 

 
  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 ?

Specify an appropriate format string with the to_char function.


David J.


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

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