Project

General

Profile

Bug #16349

Updated by Tom Clegg over 4 years ago

<pre> 
 create temporary table foo ( 
   twith timestamp with time zone, 
   twithout timestamp without time zone 
 ); 

 insert into foo values (current_timestamp, current_timestamp); 

 select * from foo; 
              twith               |            twithout           
 -------------------------------+---------------------------- 
  2020-04-22 12:40:20.796205-04 | 2020-04-22 12:40:20.796205 

 select extract(epoch from twith) - extract(epoch from twithout) from foo; 
  ?column?  
 ---------- 
     14400 

 select '2020-04-22 15:36:15 UTC' - twith, '2020-04-22 15:36:15 UTC' - twithout from foo; 
      ?column?       |      ?column?      
 ------------------+----------------- 
  -00:01:45.153064 | 03:58:14.846936 

 set time zone 'UTC'; 
 SET 

 select * from foo; 
              twith               |            twithout           
 -------------------------------+---------------------------- 
  2020-04-22 16:40:20.796205+00 | 2020-04-22 12:40:20.796205 

 </pre> 

Back