?
Solved

SQL Server Time Zone issue

Posted on 2006-07-05
5
Medium Priority
?
1,036 Views
Last Modified: 2009-02-19
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
Comment
Question by:smpross
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17042872
The function
GETUTCTIME()   will return the GMT time
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 17042878
Sorry
its GETUTCDATE()
0
 

Author Comment

by:smpross
ID: 17043171
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
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17092465
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
 
LVL 1

Expert Comment

by:MikeBrearton
ID: 23679619
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

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question