[ACCEPTED]-How do I use GMT times in postgresql?-timezone

Accepted answer
Score: 34

Start here - section 8.5.3. "Time Zones" from 13 the documentation.

The difference between 12 CURRENT_TIMESTAMP and LOCALTIMESTAMP is 11 the type of the result - the former returns 10 "timestamp with time zone" and 9 the latter - "timestamp":

milen=> select CURRENT_TIMESTAMP;
              now
-------------------------------
 2009-09-05 01:21:37.595704+03
(1 row)

milen=> select LOCALTIMESTAMP;
         timestamp
----------------------------
 2009-09-05 01:21:41.956355
(1 row)

It's 8 another matter entirely at which time zone 7 you want to see the current time. In this 6 case the default time zone (that could set 5 in several ways, all described in the section 4 linked above) is important. Also you could 3 use "AT TIME ZONE" in a query to get the current time 2 at specific time zone without "fiddling" with 1 the "timezone" setting:

milen=> select CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
          timezone
----------------------------
 2009-09-04 22:21:44.418236
(1 row)

More Related questions