Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Thu, 10 May 2001 @ 19:10:36 GMT

  <Prev Next>   <<First <Prev

Subj:   Re: Time based arithmetic
From:   Geoffrey Rommel

I can't answer your second question, but I can answer this one:

  What is the best way to convert this real number to a time data type?  

You're gonna love this.

select cast(cast(cast(TimeFld as format '99:99:99.99')
as char(11)) as time(6))
from DBC.EventLog ...

There is another approach, although I don't recommend it. You could convert everything to seconds and do the arithmetic on that, like so:

sel (cast(TimeFld as integer) / 10000) * 3600
+ ((cast(TimeFld as integer)
/ 100) mod 100) * 60
+ TimeFld mod 100
from DBC.EventLog ...

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