I can able to get time of local sql server by GetDate() function. Sql server machine is in india.
Now I want to get the current datetime of USA on same sql server what can I do.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to use the
SYSDATETIMEOFFSETcall (instead of justGETDATE()) to get your local time with the timezone information:and then you can use the
SWITCHOFFSETfunction to define a new timezone you’re interested in – based on UTC time. So the East Coast of the USA would be UTC -5 hourswhile the West Coast is UTC -8 hours: