Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 21 Dec 2006 @ 19:51:24 GMT


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


Subj:   Re: Converting Time to seconds
 
From:   Dieter Noeth

Anomy.Anom wrote:

  Can anyone suggest how to convert HH:MI:SS to seconds i.e. integer in Teradata. For example: 00:01:20 should be 80 seconds  



     SELECT
        '00:01:20' (TIME(0)) AS xx,
        EXTRACT(HOUR FROM xx) * 3600 +
        EXTRACT(MINUTE FROM xx) * 60 +
        EXTRACT(SECOND FROM xx) AS secs;

       *** Query completed. One row found. 2 columns returned.
       *** Total elapsed time was 1 second.

            xx         secs
     --------  -----------
     00:01:20           80

Dieter



     
  <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: 15 Jun 2023