Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 30 Apr 2004 @ 14:02:37 GMT


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


Subj:   Converting time in miliseconds to TIEMSTAMP in teradata
 
From:   Agarwal, Rishi

Hi,

I need to convert the timestamp value in millisecond to actual TIMESTAMP. In SQL server, same thing is done using teh user defined function:

     CREATE function TimestampToDate (@timestamp decimal(19,0)) returns
     datetime
     AS
     BEGIN
     declare @secs int, @date datetime
     select @secs = @timestamp /1000
     select @date = dateadd(s,@secs,  '1969-12-31 17:00:00' )
     return(@date)
     END

As there is no function equivalent to 'dateadd' in teradata, there is no direct method to achieve this. In that case, what could be the best possible way to achive this conversion.

I referred to the thread www.teradataforum.com/teradata/20040213_152551.htm in this forum. I want the same thing as asked by Dheeraj and I followed the same approach suggested by Victor in this thread. With this I could achieve the date part using SYS_CALENDAR.CALENDAR view, but still not able to get the time part. Can anyone help??

Dheeraj, can you suugest me the formulae if you have already acheived this.


Thanks in advance

Rishi



     
  <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