Solved

.net remoting and SQL Timezones

Posted on 2006-07-06
6
321 Views
Last Modified: 2012-06-27
Hi All,
Could someone point me to a resource that would explain how when .net remoting calls Microsoft SQL for a  time object that is stored in the SQL database (Such as an appointment time).  If the SQL Server is in a different time zone from the user's computer, how does the time object handle this?

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
  • 3
6 Comments
 
LVL 12

Expert Comment

by:topdog770
ID: 17052680
What we typically do to address this issue of different time zones, is store the time values in the database using greenwhich time and then when loading the time in a client app, take the database greenwhich time add the localized timezone offset.

0
 

Author Comment

by:smpross
ID: 17052725
Topdog,
Ok, but how do you know the local time zone of the computer?  Also we may have a need for a user to see what time the appointment is in cst even though they are in pst.

Any thoughts?

Scott
0
 
LVL 12

Accepted Solution

by:
topdog770 earned 500 total points
ID: 17052802
== Sample project and data ==
http://channel9.msdn.com/ShowPost.aspx?PostID=142586

== Some Basic Info ==
"Coding Best Practices Using DateTime in the .NET Framework"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/datetimecode.asp
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 12

Expert Comment

by:topdog770
ID: 17052844
I'd be tempted to create your own time entity that stored the date time in what ever format works best for your overall plans, throw in any conversion steps that you need and additionally store the appointments "time zone of creation" value so that you would be able to say things like this:

Michael created a 1 PM appointment July 06, 2006 PDT.  

for a viewer on the east coast you could display

Michael has a 4PM appointment( 1PM PDT) today, with Frank to discuss...

MyConceptOfATimeObject
{
  // universal time of appt
  // time zone of owner

  // common conversion and format functions
}

0
 

Author Comment

by:smpross
ID: 17053434
Topdog,
It is funny that you say that... That is what we originally did, however, what I found was this:
The SQL Server was in EST.
The client was in CST time
The time was stored in the database in GMT.

When the GMT time was requested, the client would perform the conversion to CST.  However, what we found is that a secondary conversion occured that between the SQL server time zone and the Client.

Here is an example:

The appointment time was stored in GMT as 5:00 pm
The client (in CST) performed the conversion to 12:00 pm (- 5 hours for GMT)
It then performed a secondary conversion to 11: am to compensate for the difference between the SQL Server time zone and the client time zone.

Scott
0
 

Author Comment

by:smpross
ID: 17053443
BTW, the MS article is just what I needed!  Thanks.

Scott
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 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