Posted By

ezerick on 07/08/11


Tagged


Versions (?)

T-SQL Function to convert Unix Timestamp into MS SQL datetime « ProgAdv


 / Published in: SQL
 

URL: http://skinn3r.wordpress.com/2009/01/26/t-sql-function-to-convert-unix-timestamp-into-ms-sql-datetime/

  1. CREATE FUNCTION UNIX_TIMESTAMP_TO_DATETIME (
  2. @timestamp integer
  3. )
  4. RETURNS datetime
  5. AS
  6. BEGIN
  7. /* Function body */
  8. DECLARE @RETURN datetime
  9.  
  10. SELECT @RETURN = DATEADD(second, @timestamp,{d '1970-01-01'});
  11.  
  12. RETURN @RETURN
  13. END

Report this snippet  

You need to login to post a comment.