Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 26 Mar 2003 @ 18:45:02 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Timestamp difference
 
From:   Glen Blood

I couldn't get differences in timestamps in a straightforward manner in V2R4.0. May have been my fault, but I tried everyway from Sunday. This is an example of my kludge (it works):

SELECT CAST(CAST(CAST(LOGDATE AS FORMAT 'YYYY-MM-DD') AS CHAR(10)) || '
'
|| CAST( LOGTIME AS CHAR(15)) AS TIMESTAMP)
,CAST(CAST(CAST(LOGONDATE AS FORMAT 'YYYY-MM-DD') AS CHAR(10)) || ' '
||
CAST(LOGONTIME AS CHAR(15)) AS TIMESTAMP)
,CAST((LOGDATE - LOGONDATE) * 24 * 3600
+ (EXTRACT(HOUR FROM LOGTIME) - EXTRACT(HOUR FROM LOGONTIME)) * 3600
+ (EXTRACT(MINUTE FROM LOGTIME) - EXTRACT(MINUTE FROM LOGONTIME)) * 60
+ (EXTRACT(SECOND FROM LOGTIME) - EXTRACT(SECOND FROM LOGONTIME))
AS INTEGER)

LOGTIME and LOGONTIME come from DBC.LOGONOFF.



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016