Solved

.net remoting and SQL Timezones

Posted on 2006-07-06
6
317 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

831 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