Solved

.net remoting and SQL Timezones

Posted on 2006-07-06
6
318 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
  • 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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