My server is hosted in US or so with some other time zone. Is there an option to get the current date in SQL Server in Indian Standard Time.
select getdate()
What should I write to get the current time in India(or some other country as such).
My server is hosted in US or so with some other time zone. Is there an option to get the current date in SQL Server in Indian Standard Time.
select getdate()
What should I write to get the current time in India(or some other country as such).
According to this link India's time is
9:30 hours ahead
from US. So in-order to get the Indian time, you need to add9.30 hours
to US time.You should use the
DATETIMEOFFSET
datatype which includes the timezone, and theSWITCHOFFSET
method to switch between timezones. Also: to get the current time, useSYSDATETIMEOFFSET()
instead ofGETDATE()