GO
/****** Object: UserDefinedFunction [dbo].[convertutcdatetime] Script Date: 9/8/2016 12:06:05 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[convertutcdatetime]()
RETURNS datetime
AS
BEGIN
DECLARE @ret datetime;
declare @Diff nvarchar(20)
select @Diff=TimeZone from Country
SELECT @ret = convert(Datetime,switchoffset (CONVERT(datetimeoffset, GETUTCDATE()),@Diff));
RETURN @ret;
END;
is there any mistake
i got an error like this:
Msg 9812, Level 16, State 0, Line 1
The timezone provided to builtin function switchoffset is invalid.
The timezone provided to builtin function switchoffset is invalid.
please rectify me inthat @diff i put +530 i got out put.in my table value also +530 but it doesnot work helpme
Midhun TpPosted Sep 8, 2016, 2:56 AM
Nitin SontakkePosted Sep 8, 2016, 2:53 AM