问题
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'
- 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:
- Open the command prompt
- Run the command tzutil /s "your specific time zone"
- 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