Sql-server – SQL Server and SharePoint time problem

datetimesharepointsql-server-2012timezone

I have created a SharePoint application which has a specific time zone.
The Windows server where SQL Server and SharePoint are installed are using same time zone.

When I create a new item in list in SharePoint it shows some different time zone time.

I don't know why this is happening but I suspect this is because of SQL Server. If I query current date and time in SQL Server then it shows correct time zone but in SharePoint it is showing different times.

What could be the reason?

Best Answer

SQL Server gets its time Zone information from the operating system on which it is installed. So if SELECT GETDATE() reveals the right information, then SQL Server is most likely not the problem.

You can query the registry on your SQL Server, if you have the appropriate permissions, and see what the server's time zone is set to:

    DECLARE @TimeZone NVARCHAR(255)

EXEC master.dbo.xp_instance_regread 

N'HKEY_LOCAL_MACHINE', 

N'SYSTEM\CurrentControlSet\Control\TimeZoneInformation',

N'StandardName',

@TimeZone OUTPUT


SELECT @TimeZone

That should tell you what time zone your SQL Server thinks it is in.

I would suggest that the issue is either the client on which you are running the SharePoint application session - or more likely a setting in SharePoint itself or the server time zone on the SharePoint server itself.

You can check the regional settings for a site and see what it reports. This link should help get you started there.