Обсуждение: select current UTC time ?
Hi List; How could I select the current UTC time ? now() cast as a timestamp at UTC is wrong because it takes now() and says: if it were now() time UTC what would it be here (timezone) and returns that. I want to return 'what time is it now in UTC ?' Thanks in advance... /Kevin
On Jun 5, 2008, at 1:01 PM, kevin kempter wrote: > Hi List; > > How could I select the current UTC time ? now() cast as a timestamp > at UTC is wrong because it takes now() and says: if it were now() > time UTC what would it be here (timezone) and returns that. I want > to return 'what time is it now in UTC ?' > > Thanks in advance... > > /Kevin > > > -- > Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-admin Ignore this post, the first query gives me the right answer [as does : select timeszone('UTC', now()) ] - neurons firing slowly today.
kevin kempter wrote: >How could I select the current UTC time ? now() cast as a timestamp >at UTC is wrong because it takes now() and says: if it were now() time >UTC what would it be here (timezone) and returns that. I want to >return 'what time is it now in UTC ?' SELECT EXTRACT('epoch' FROM CURRENT_TIMESTAMP AT TIME ZONE 'UTC')::bigint::int Rainer
This seems to work for me: template1=# select now() at time zone 'UTC'; timezone ---------------------------- 2008-06-05 19:08:50.590806 (1 row) template1=# select now(); now ------------------------------- 2008-06-05 14:08:57.278037-05 Cheers. -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of kevin kempter Sent: Jun 05, 2008 2:01 PM To: pgsql-admin@postgresql.org Subject: [ADMIN] select current UTC time ? Hi List; How could I select the current UTC time ? now() cast as a timestamp at UTC is wrong because it takes now() and says: if it were now() time UTC what would it be here (timezone) and returns that. I want to return 'what time is it now in UTC ?' Thanks in advance... /Kevin -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin