Get Local Date Time


CREATE FUNCTION [dbo].[ufn_utl_GetLocalDateTime]
(
    @StartDate DATETIME
)
RETURNS DATETIME
AS
BEGIN
    RETURN (DATEADD(
                       HOUR,
                       (CAST(DATEPART(HOUR, SYSDATETIME()) AS INT) - CAST(DATEPART(HOUR, SYSUTCDATETIME()) AS INT)),
                       @StartDate
                   )
           );
END;
GO


Comments

Popular posts from this blog

Calculating Age of the person in T-SQL

How to Troubleshoot Subscription issue in Reporting Services