Wednesday, June 1, 2011

Convert DateTime to Indian Standard Time format in SQL Server

DATEADD() function would be used to convert UTC to IST in SQL Server.

Below is the sample code for that.

DECLARE @UTCTime As DATETIME;
SET @UTCTime = GETUTCDATE();
SELECT DATEADD(MI, 330, @UTCTime) AS IST

Happy Coding…

1 comment:

  1. SELECT SWITCHOFFSET(SYSDATETIMEOFFSET(),'+05:30') as [CurrentDateTime]

    ReplyDelete