Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1066
  • Last Modified:

SQL Server Time Zone issue

Hi All,
We are using Microsoft SQL 2005 for our database for a .net remoting application. The application is used in several time zones and accesses the same SQL Server which is in the EST time zon.   Here is my question:

We store an appointment date as the date and time. When the SQL Server in the EST zone passes the time to a client in the CST zone, the client changes the time to CST.  We do NOT want this to happen.  We are performing our own calculation for the time in the client application based on the users division.  How can we tell the client to get the data, but do not calculate the data to the time zone of the workstation.


Any help would be greatly appreciated.

Scott
0
smpross
Asked:
smpross
  • 3
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
The function
GETUTCTIME()   will return the GMT time
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
Sorry
its GETUTCDATE()
0
 
smprossAuthor Commented:
Anees,
I do not want to convert to anytime.  I just want it to return what is stored in the table with no conversions by the SQL Server or the desktop computer.  Any ideas?

Scott
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
I hope i didn't understand
if it is stored in the table, you can easily return by specifying the column name in the select statement

0
 
MikeBreartonCommented:
this may go against the grain but...
... I found that retrieving a date using SQL in my .NET application worked perfectly;  retrieving the date using a stored procedure containing the exact same SQL caused unwanted time shifting.  

I don't know why this works, which makes me afraid it will stop one day.  But it does.

I'm a complete "Stored Procedures only" kind of guy... but I haven't managed to get SqlServer to behave correctly in timezone sensitive environments any other way.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now