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

2018-07-11 Thread Adrian Klaver
On 07/11/2018 02:21 PM, David Gauthier wrote: Pleas reply to list also. Ccing list. Table columns have already been defined with timestamp datatype.  The on;y way I know of to fix this is to... 1) add a new column as timestamptz called 'tmp' (whatever) 2) update tmp with the value in the time

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

2018-07-11 Thread Adrian Klaver
On 07/11/2018 01:34 PM, David Gauthier wrote: Thanks Everyone, they all work, but TL's seems to be the simplest... select current_timestamp(0) at time zone 'utc' I'm kinda stuck with the timestamp data type (vs timestamptz). Wondering if I can stick with that. The above is at little unclear.

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

2018-07-11 Thread David G. Johnston
On Wednesday, July 11, 2018, David Gauthier wrote: > > I want to store the current UTC date/time in the DB. Does PG > unconditionally store something like UTC, then let the queries figure out > how they want to look at it (with "at time zone" and "to_char()" etc...) ? > Or do I have to intentiona

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

2018-07-11 Thread David Gauthier
Thanks Everyone, they all work, but TL's seems to be the simplest... select current_timestamp(0) at time zone 'utc' I'm kinda stuck with the timestamp data type (vs timestamptz). Wondering if I can stick with that. One last question... I want to store the current UTC date/time in the DB. Does

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

2018-07-11 Thread David G. Johnston
On Wednesday, July 11, 2018, David Gauthier wrote: > OK, the "to_char" gets rid of the timezone extension. But the times still > don't make sense. > > When I go to store this in a DB, I want to store the UTC time. How d I do > that ? > Use the data type that represents exactly that, timestampt

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

2018-07-11 Thread Adrian Klaver
On 07/11/2018 12:59 PM, David Gauthier wrote: 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 st

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

2018-07-11 Thread David Gauthier
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. Ho

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

2018-07-11 Thread Adrian Klaver
On 07/11/2018 12:36 PM, David Gauthier wrote: Hi: And I want to get rid of the -04 suffix. Is there a way to do this ? For the details see: https://www.postgresql.org/docs/10/static/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT Thanks ! -- Adrian Klaver adrian.kla...@aklaver

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

2018-07-11 Thread Tom Lane
David Gauthier writes: > sqfdev=> select now()::timestamp(0) at time zone 'utc' ; > timezone > > 2018-07-11 11:27:12-04 > (1 row) You're doing it wrong: coercing to timestamp already involves a rotation to local time, and then "at time zone" says to interpret tha

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

2018-07-11 Thread Adrian Klaver
On 07/11/2018 12:36 PM, David Gauthier wrote: select now()::timestamp(0) at time zone 'utc' ; Or: test=> select now(); now --- 2018-07-11 12:51:50.498416-07 (1 row) test=> select now()::timestamptz(0) at time zone 'utc' ; timezone -

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

2018-07-11 Thread Adrian Klaver
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

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

2018-07-11 Thread David G. Johnston
On Wednesday, July 11, 2018, 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 > -

timestamp (military) at time zone without the suffix

2018-07-11 Thread David Gauthier
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