CREATE FUNCTION [dbo].[UNIX_TIMESTAMP_TO_DATETIME] ( @timestamp integer ) RETURNS datetime AS BEGIN DECLARE @return datetime SET @timestamp = @timestamp - 18000 SELECT @return = DATEADD(second, @timestamp,{d '1970-01-01'}); RETURN @return END
The function takes as a parameter a Unix Timestamp value so that it is converted into Datetime, and it will then give you the equivalent value in SQL Server Datetime format. I know it might not be the be-all and end-all, nevertheless, I am pretty sure it will be use for many people. I hope you make the most out of it. That’s all for now. Let me know any remarks you may have. Thanks for reading. Stay tuned.
No comments:
Post a Comment
Let me know any remarks or questions you may have. Please write down your name.