Whole Number to Timestamp

Database
Fan

Whole Number to Timestamp

Hi,

I have a column (Col1), which contains values from 1 to 96 and these values represents time in every 15 minutes for 24 hours as below:-

How do i generate Col2 from Col1?? Is there any function in Teradata? Just like DATEADD in SQL Server. I do not want to use Case Statements.

Col1     Col2

1        - 12:00:00

2        - 12:15:00

3        - 12:30:00

4        - 12:45:00

5        - 1:00:00

and so on to 96


Accepted Solutions
Fan

Re: Whole Number to Timestamp

Thank you, Dnoeth!

It worked, i just need to cast the col1 as Int.

 

Time '00:00:00' + (interval '15' minute * (cast(col1 -1 as integer)))

 

Thanks!

1 ACCEPTED SOLUTION
2 REPLIES
Junior Contributor

Re: Whole Number to Timestamp

Add n times 15 minutes to midnight:

time '00:00:00' + (interval '15' minute * (Col1-1))

 

Fan

Re: Whole Number to Timestamp

Thank you, Dnoeth!

It worked, i just need to cast the col1 as Int.

 

Time '00:00:00' + (interval '15' minute * (cast(col1 -1 as integer)))

 

Thanks!