Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting seconds in time format

Status
Not open for further replies.

pucklinger

Technical User
Mar 20, 2003
2
ES
Hi,

I got a problem:
I have a column c1 with seconds stored as integer data type.
I want to display time format.
e.g. 61 second should be displayed as 00:01:01.

I tried severel things, but nothing helped.

select time '00:00:00' + interval column1 second from talbe1

doesn't work, because teradata accepts only strings as intervals?!?!?

Has someone a hint for me?

Thanks a lot!

Cheers,
Pucklinger


 
If c1 is always less than 9999 you can use
sel 61 as x,
cast(cast (x as interval second(4,0)) as interval hour to second(0));

if it's > 9999:
sel 99999 as x,
cast(
cast (x / 3600 as interval hour(4)) +
cast (x mod 3600 as interval second(4,0))
as interval day(4) to second(0))

Dieter
 
Hi Dieter!

thanx for your fast help!
Works perfekt....
Had not the idea to cast as intervall.


Cheers
Pucklinger

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top