Setting time Zone in MS SQL Server Database

夙愿已清 提交于 2019-12-13 06:31:08

问题


i am using php with mssql, on windows azure cloud storage , when i insert datetime with code then it insert

 '2013-05-30 11:31:47.000'

(which is correct time with indian time zone)

but when i use getdate() to insert in other column it inserts '2013-05-30 06:01:46.507'

  1. any idea how can we set default time zone to indian delhi - with any database settings /azure ?

回答1:


According to MSDN, getdate() returns the current database system timestamp:

This value is derived from the operating system of the computer on which the instance of SQL Server is running.

You can change the timezone with tsutil.exe:

tzutil /s "India Standard Time" 



回答2:


  1. Open the command prompt
  2. Run the command tzutil /s "your specific time zone"
  3. Ex : tzutil /s "India Standard Time".

Then it will system time zone and sql server too...



来源:https://stackoverflow.com/questions/16830012/setting-time-zone-in-ms-sql-server-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!