Skip to content

Instantly share code, notes, and snippets.

@fcojperez
Last active December 14, 2015 21:09
Show Gist options
  • Save fcojperez/5149520 to your computer and use it in GitHub Desktop.
Save fcojperez/5149520 to your computer and use it in GitHub Desktop.
Función para la Conversión Unix Time/POSIX time a Fecha en Transact-SQL
/*
FUNCTION [UTC2Date]: Para convertir la hora UTC en hora local
PARAEMTROS:
@date: número de segundos desde '1970-01-01'
*/
CREATE FUNCTION [UTC2Date] (@date int ) 
RETURNS  datetime
BEGIN    declare @NewDate datetime
    set @NewDate = DATEADD([second], @date, ’1970-01-01′)
    RETURN @NewDate
END;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment