.net remoting and SQL Timezones

Posted on 2006-07-06
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.

Question by:smpross
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
LVL 12

Expert Comment

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.


Author Comment

ID: 17052725
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?

LVL 12

Accepted Solution

topdog770 earned 500 total points
ID: 17052802
== Sample project and data ==

== Some Basic Info ==
"Coding Best Practices Using DateTime in the .NET Framework"
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 12

Expert Comment

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...

  // universal time of appt
  // time zone of owner

  // common conversion and format functions


Author Comment

ID: 17053434
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.


Author Comment

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


Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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 …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below.…
Suggested Courses

737 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